msync | bitrate copy of a music library | Incremental Backup library
kandi X-RAY | msync Summary
kandi X-RAY | msync Summary
Maintain a lower-bitrate copy of your music library, in sync with the main copy. Think of it as rsync, but only for music files, and with the ability to transcode high-bitrate or lossless files to lower-bitrate files suitable for use on devices with less storage. It's also more opinionated than rsync, with behaviors tailored for exactly this use case. For example, msync will always remove files from the destination which are missing from the source; whereas rsync won't do this unless you pass it the --delete flag.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- msyncMain is the main entry point for msync .
- makeMusicTreeNode creates a new music tree node
- WithProgress returns a context containing the progress of the given context .
- MakeMusicTree creates a MusicTreeNode
- initSpinner initializes the spinner and returns it .
- WithSpinner adds a spinner to the context
- Main entry point .
- fileBitrate returns the bitrate
- CopyFile copies a file
- ByteCountSI returns a string representation of bytes .
msync Key Features
msync Examples and Code Snippets
Community Discussions
Trending Discussions on msync
QUESTION
Both OpenGL and Vulkan allow to obtain a pointer to a part of GPUs memory by using glMapBuffer
and vkMapMemory
respectively. They both give a void*
to the mapped memory. To interpret its contents as some data it has to be cast to an appropriate type. The simplest example could be to cast to a float*
to interpret the memory as an array of floats or vectors or similar.
It seems that any kind of memory mapping is undefined behaviour in C++, as it has no notion of memory mapping. However, this isn't really an issue because this topic is outside of the scope of the C++ Standard. However, there is still the question of volatile
.
In the linked question the pointer is additionally marked as volatile
because the contents of the memory it points at can be modified in a way that the compiler cannot anticipate during compilation. This seems reasonable though I rarely see people use volatile
in this context (more broadly, this keyword seems to be barely used at all nowadays).
At the same time in this question the answer seems to be that using volatile
is unnecessary. This is due to the fact that the memory they speak of is mapped using mmap
and later given to msync
which can be treated as modifying the memory, which is similar to explicitly flushing it in Vulkan or OpenGL. I'm afraid though that this doesn't apply to neither OpenGL nor Vulkan.
In case of the memory being mapped as not GL_MAP_FLUSH_EXPLICIT_BIT
or it being VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
than no flushing is needed at all and the memory contents update automagically. Even if the memory is flushed by hand by using vkFlushMappedMemoryRanges
or glFlushMappedBufferRange
neither of these functions actually takes the mapped pointer as a parameter, so the compiler couldn't possibly know that they modify the mapped memory's contents.
As such, is it necessary to mark pointers to mapped GPU memory as volatile
? I know that technically this is all undefined behaviour, but I am asking what is required in practice on real hardware.
By the way, neither the Vulkan Specification or the OpenGL Specification mention the volatile
qualifier at all.
EDIT: Would marking the memory as volatile
incur a performance overhead?
ANSWER
Answered 2021-Mar-11 at 22:02OK, let's say that we have a compiler that is omniscient about everything that happens in your code. This means that the compiler can follow any pointer, even through the runtime execution of your code perfectly and correctly every time, no matter how you try to hide it. So even if you read a byte at one end of your program, the compiler will somehow remember the exact bytes you've read and anytime you try to read them again, it can choose to not execute that read and just give you the previous value, unless the compiler is aware of something that can change it.
But let's also say that our omniscient compiler is completely oblivious to everything that happens in OpenGL/Vulkan. To this compiler, the graphics API is a black box. Here, there be dragons.
So you get a pointer from the API, read from it, the GPU writes to it, and then you want to read that new data the GPU just wrote. Why would a compiler believe that the data behind that pointer has been altered; after all, the alterations came from outside of the system, from a source that the C++ standard does not recognize.
That's is what volatile
is for, right?
Well, here's the thing. In both OpenGL and Vulkan, to ensure that you can actually read that data, you need to do something. Even if you map the memory coherently, you have to make an API call to ensure that the GPU process that wrote to the memory has actually executed. For Vulkan, you're waiting on a fence or an event. For OpenGL, you're waiting on a fence or executing a full finish.
Either way, before executing the read from the memory, the omniscient compiler encounters a function call into a black box which as established earlier the compiler knows nothing about. Since the mapped pointer itself came from the same black box, the compiler cannot assume that the black box doesn't have a pointer to that memory. So as far as the compiler is concerned, calling those functions could have written data to that memory.
And therefore, our omniscient-yet-oblivious compiler cannot optimize away such memory accesses. Once we get control back from those functions, the compiler must assume that any memory from any pointer reachable through that address could have been altered.
And if the compiler were able to peer into the graphics API itself, to read and understand what those functions are doing, then it would definitely see things that would tell it, "oh, I should not make assumptions about the state of memory retrieved through these pointers."
This is why you don't need volatile
.
Also, note that the same applies to writing data. If you write to persistent, coherent mapped memory, you still have to perform some synchronization action with the graphics API so that your CPU writes so that the GPU isn't reading it. So that's where the compiler knows that it can no longer rely on its knowledge of previously written data.
QUESTION
I am trying to read and write a struct using mmap, however the changes I do after the mmap are not being persisted to the disk or are not being loaded correctly.
Here's my code sample, when run the first time the file is created and the prints show the correct data, on the second time when the file already exists the struct is empty, filled with 0's. So it looks like the changes were not written to the file but I am having trouble figuring out why.
...ANSWER
Answered 2020-Jul-02 at 11:44Do not use MAP_PRIVATE because:
QUESTION
I am new to ELF and C programming.
I wanna set e_shstrndx which locates ELF header to 0 to avoid debugging by using msync system call.
I program this code, but it seems not working.
...ANSWER
Answered 2020-Jun-08 at 13:41There are 2 errors in your code.
- you need to open the file with O_RDWR flag instead of O_RDONLY.
- you need to call mmap with MAP_SHARED argument instead of MAP_PRIVATE.
Here is simplified version of your code with log statements that modifies the 4th byte of an 6-byte ASCII file:
QUESTION
I get the following error when I try to create a ChronicleMap:
...ANSWER
Answered 2020-May-10 at 13:20Latest released version of Chronicle-Map depends on fairly old jna version (4.2.1) which doesn't work well with recent Windows. You can try last snapshot version (3.19.5-SNAPSHOT) as we haven't released it yet, or try overriding jna version in maven, e.g. add this to your dependency-management section:
QUESTION
I have an iOS app that works perfectly fine on all devices unless they are using iOS 12. I am not sure what the issue is. I tried downloading the app directly from my laptop, and it worked fine. But, when it is downloaded from the App Store or TestFlight, it crashes on launch.
This is my crash log:
...ANSWER
Answered 2020-May-03 at 11:188badfood
is a watchdog timer exception. You must exit didFinishLaunching
with a view presented as soon as possible.
If you have to load a large amount of data then you should present an initial "loading" view and perform the load, moving to the actual UI once that is complete.
This is to avoid an impression to the user that the app has just "hung".
The fact that you are only getting the crashes on iOS 12 devices is probably because they are older, slower devices.
QUESTION
Having read the manual of msync
, I think the exact meaning of MS_INVALIDATE
is as follows:
Provided that there are three processes p1, p2, and p3.
p1 and p2 both use mmap
with MAP_SHARED
to simutaneously read and write the file /tmp/data.txt
.
p3 uses fread
to read the same file.
Assume that p1 have modified the file, p2 will immediately see the modification. However, p3 using fread
is not sure to see the modification.
If p1 call msync
with MS_INVALIDATE|MS_SYNC
after the modification, then p3 using fread
is SURE to see the modification. That's all the meanings of the flag MS_INVALIDATE
.
Is my understanding correct?
...ANSWER
Answered 2020-Mar-08 at 23:52AFAIK, on linux kernel, MS_INVALIDATE actually doesn't do much, this is from msync.c
The only use is this check.
QUESTION
Linux version: 4.19
Platform: Xilinx Ultrascale+ Zynq
In the programmable logic I've created a memory mapped device located at physical address 0xA0001000. I'm using uio_pdrv_genirq as my device driver. The device shows up as uio0 and I'm ready to read and write to it, using mmap. I want to be able to guarantee that any writes that I make get written to the device right away instead of waiting for Linux to flush the dirty pages on its own. For that I should use msync according to all my research. But I keep getting an error when I do that. Here's my test program:
...ANSWER
Answered 2020-Feb-12 at 13:23I believe the EINVAL
error is because the kernel's handler for the msync
syscall (in "mm/msync.c") calls vfs_fsync_range
:
QUESTION
We are using ML instance on AWS. We are using magnetic disks to store data. We are experiencing a lot of slow fsync messages in our log files
...ANSWER
Answered 2019-Jul-10 at 14:38This knowledge base article has a lot of great detail about these error messages.
In particular, an fsync should complete in milliseconds so seeing that its taking about 2.5 seconds to complete is very concerning:
QUESTION
I'm experimenting with memory mapped file in Linux and have a question of what actually going on when mapping the same file from different processes and writing beyond the end of file.
I created a file with vim by hand and wrote 2 bytes in there:
...ANSWER
Answered 2019-Jun-04 at 17:56The definitive reference in these matters is POSIX, which in its rationale section for mmap has to say:
The mmap() function can be used to map a region of memory that is larger than the current size of the object. [... snip discussion on sending SIGBUS if possible, i.e. when accessing a page beyond the end of the file ...] written data may be lost and read data may not reflect actual data in the object.
So, POSIX says that doing this can result in lost data. Also, the portability is questionable at best (think about no-MMU systems, the interaction with hugepages, platforms with different pagesizes...)
QUESTION
My Develop Environment is Android Studio with NDK. Min SDK level is 26 for use NDK shared mem header. https://developer.android.com/ndk/reference/group/memory
I succeed in using shared memory between child and parents. but problem is, I need to make file descriptor before fork()
. Below is how I did it.
- Make File Descriptor(
AsharedMemory_create
) from parents. - fork()
- mmap from child using parents file descriptor. Work some stuff on a buffer.
- mmap from parents for sync and get buffer.
It works fine but it needs to pre-make from parents before the fork. I don't want it. Also, I don't want to use Parcel file descriptor in Java.
I want to make shared memory wherever I want and share with other process But not using pass it. Is there a way for using 'same' shared memory between child and parents? or between different processes (kinds like the child with child)?
I tried make File descriptor that has Same name, Same size in child and parents for shared memory, But it doesn't works. Also tried to make File descriptor and mmap in parents after child did the same thing but it didn't works either even I didn't munmap or close in a child. All I can get is NULL
in parents or other child. is it just impossible?
//========================(11.15.2018 Update)
================================
- Making fd in child and close. Open it from parents (X)
- Making fd in child and sleep. Open it from parents (X)
- Making fd in child and msync. Open it from parents (X)
ANSWER
Answered 2018-Nov-28 at 04:42I checked many things but it can't achieved. There is no magic solution. If i want to use shared memory that using other process's FD, i need to FD get that via IPC. Also android suggest Unix Domain Socket to pass fd.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install msync
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page