Questions tagged [shared-memory]
The shared-memory tag has no usage guidance.
81
questions
0
votes
0
answers
14
views
Tool to show memory that would be freed if I terminate a process and its sub processes?
I know that it's a bit tricky to show the memory that a process is using due to the fact that there is memory shared.
But when I look at memory diagnostics, it's normally because my memory is getting ...
0
votes
2
answers
42
views
Why does ftruncate with a shared memory object not use memory?
I've observed that I can create a shared memory object and give it ostensibly any size with ftruncate, regardless of the resource limits on my system. The code below sets the size to 262 TB, and ...
0
votes
0
answers
24
views
Is it possible to implement kvm/qemu VM guests and host connected through shared memory to collect and cache data between them
The configuration:
host: Ubuntu:20.04 OS
guest: Ubuntu20.04 OS
The two files use the 9p file system for interworking.
The mount command is as follows,
mount -t 9p -o trans=virtio tmp_shared /mnt -...
0
votes
1
answer
412
views
Is it possible for two processes to use the same shared-memory without resorting to a file to obtain it, be it a memory-mapped file or /dev/shm file?
I'm curious because today the only way I know how to give two different processes the same shared-memory is through a memory-mapped file, in other words, both processes open the same memory-mapped ...
0
votes
1
answer
472
views
How to Add some System Memory to be shared with the GPU in Linux?
I have switched from Windows 10 to linux mint 21.1
I tried playing GTA 5 on lutris (wine emulation) however the game is almost unplayable on linux as big parts of the map will not load because of my ...
0
votes
1
answer
66
views
Using IPC_CREAT with an already created shared memory segment
I am trying to figure out what will happen if I use the IPC_CREAT flag with shmget(). I have used a key of an already created shared memory segment from another process. When I did so, the calling ...
0
votes
1
answer
95
views
Shared Memory using shmget() and shmat()
We can create and attach a shared memory to a process using shmget() and shmat(). What will happen if we don't destroy and detach the shared memory in Ubuntu OS ? According to my understanding it will ...
0
votes
1
answer
98
views
shmget() and shmat()
Using shmget(), we can allocate a shared memory block of certain size in bytes and using shmat(), we attach this shared memory block to the address space of the calling process.
I need to check my ...
0
votes
0
answers
336
views
Shared memory between user module and kernel module
I'm kind of new to kernel development.
I have a custom kernel module that needs to "communicate" some tcp network parameters to a user-level module (a python script). I don't want to rely on ...
1
vote
1
answer
84
views
What shared memory is not controlled by SHMAX/SHMALL?
We are debugging a situation where the cached/shared memory increase and increase until the system reach OOM-killer.
We have set shmax and shmall in sysctl.conf but without any visible effect. Do we ...
0
votes
0
answers
18
views
where is shm_dir defined
I have problems using shm_open, from what I've read here I understood that shm_open is the same as the regoular open just adding shm_dir before.
My question is: how can I set that specific value that ...
1
vote
1
answer
407
views
Issues Using GPSD as Source for Chronyd
I am attempting to use a USB GPS without PPS dongle as the sole time source on Ubuntu 18.04. GPSD appears to be working correctly since cgps reports a 3D fix. However, I can't get chrony to see the ...
0
votes
0
answers
160
views
How pass a queue of data from kernel to user space?
I'm currently writing a module for Linux, and I want to pass a queue of data from kernel to user space (my program in userland being responsible for read this data - and then responsible for writing ...
2
votes
1
answer
372
views
Browser (Opera, Chromium...) start causing Permission denied (13) error for shared memory
Using Manjaro / Arch linux, I wanted to install another browser. However, no matter whether I installed Opera or Chromium (via pacman) I always get an error when executing it (from both Application ...
0
votes
1
answer
61
views
Can a process share unused memory with others?
I want to run about 200 processes with my experiments. Every of them really needs less than a GB:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
24688 rinkman 20 0 ...
0
votes
1
answer
542
views
Shared memory using shmget()
According to my understanding about shared memory is that it is a memory segment that is shared between two or more processes. Shared memory can be implemented using shmget() . However , since any ...
0
votes
2
answers
1k
views
Values from sysctl -A don't match /etc/sysctl.conf even after restart
I'm on Mac Monterey 12.1 and increased my shared memory limits in /etc/sysctl.conf file:
kern.sysv.shmmax: 16777216
kern.sysv.shmmin: 1
kern.sysv.shmmni: 128
kern.sysv.shmseg: 512
kern.sysv.shmall: ...
1
vote
1
answer
4k
views
How does a process and its children use memory in case of mmap()?
Let's say, we are creating a shared memory using mmap(). Let's say the total memory size is 4096. If we use a fork() system call to create children, would the children use the same memory, or will ...
0
votes
1
answer
2k
views
When should I alter overcommit_memory and what should I take into consideration when doing so?
I'm having a PC freeze issue that I can't seem to figure out. I have three identical PCs. They are each custom builds with i7 and 64GB of RAM. The OS drives are 512GB nvme drives. They each run ...
0
votes
0
answers
103
views
shmat returns error (void *) -1 in selinux enabled rhel environment
as per the documentaion:-
If SHM_RDONLY is specified in shmflg, the segment is attached for reading and the process must have read permission for the segment. Otherwise the segment is attached for ...
0
votes
0
answers
63
views
Shared memory as reported by free not equal df reported one. Cache takes huge amount of memory despite recent drop_caches
I'm running Linux Mint 20. I often encounter low memory situations. Today I do not understand why available is so low. As per What is the meaning of `shared` memory in the `free` command? shared is ...
2
votes
1
answer
123
views
Am I making invalid assumptions with regard to my kernel module's shared memory?
I have written a "device driver" (see source code here: https://bitbucket.org/wothke/websid/src/master/raspi/websid_module/ ) that runs fine for most of the time (see https://www.youtube.com/...
4
votes
1
answer
2k
views
Shared memory usage is piling up
I'm using Ubuntu 20.04.2 LTS with kernel 5.4.0-70-generic. Shared memory keeps piling up until system hangs as it doesn't have any memory left.
I'm using Prometheus + Grafana to monitor my system ...
0
votes
1
answer
1k
views
FFmpeg cannot write file to /dev/shm: Permission Denied
Issue:
I have an FFmpeg command that I've been running for months now to stream video into the /dev/shm directory. It had been working fine until relatively recently (e.g. within a week), now it ...
1
vote
1
answer
586
views
Delete POSIX shared memory owned by different user
I have a program that creates four shared memory objects. The memory creation routine calls shm_unlink() before attempting to create them, and the program calls another routine to delete them with ...
0
votes
1
answer
1k
views
Do anonymous memory mapping and shared memory allocate space from physical memory only?
In Linux,
when using mmap() for anonymous memory mapping, or using malloc(), do they allocate "space" from only physical memory, or either physical memory or swap or their combination? (I ...
0
votes
0
answers
191
views
SIGBUS immediately after successful mremap for shared memory
I am using POSIX shared memory. Initially I map four shared memory buffers. One of them exceeds its allocated size so I call mremap:
void * remap_shm(void *old_address, size_t old_size, size_t ...
2
votes
1
answer
1k
views
How to revoke write permissions on a shared memory object s.t. subsequent writes to aleady mapped pages by other processes will fail?
Is there any way to revoke write permissions to shared memory by the process who created that shared object, s.t. any other process who has mapped the shared memory to its virtual space with write ...
2
votes
1
answer
2k
views
AMDGPU driver vramlimit
I have a console installation of debian and i found that from the available 16GB of ram i can see only 14GB, this is because my APU (AMD) is reserving 2GB which is way too much for my needs. The bad ...
0
votes
1
answer
1k
views
How to understand PBS output "mem" and "vmem" keep the same when the task is x-fold increased with mpirun -np x task
Here is a simple experiment I tried:
Given a task called "sim.exe" which doing a model simulation, I then use MPI to launch x "sim.exe" simultaneously on one node (shared memory system). I have tried ...
4
votes
1
answer
1k
views
Will swap file engage automatically when I write too much to /dev/shm
Text analytics programming today. My program is going to write about 45 million small temporary files to /dev/shm and their size estimate is 177.0 GB. I'm going to delete them soon after the next ...
3
votes
2
answers
8k
views
Are sharing a memory-mapped file and sharing a memory region implemented based on each other?
Are sharing a memory-mapped file and sharing a memory region implemented based on each other? The following two quotes seem to say so, and seem a chicken-egg problem to me.
Operating System Concepts ...
0
votes
1
answer
1k
views
calling fsync() on in-memory files
From fsync(2):
fsync() transfers ("flushes") all modified in-core data of (i.e., modified
buffer cache pages for) the file referred to by the file descriptor fd to
the disk device (or other ...
2
votes
1
answer
749
views
Processor not seeing changes to POSIX shared memory?
Context: I am using POSIX shared memory to provide a set of processes with a shared memory space. I have used this scheme for some time now in order to share data, and it's working okay. However, I ...
2
votes
1
answer
2k
views
Is the shared library object loaded as shared memory for the program?
I was coding some C when I started asking myself about free() inside a shared library and SIGKILL, and so on. Then, after some reading and re-thinking, I came up to this simple question.
CONTEXT : ...
1
vote
0
answers
751
views
Two processes sharing memory under different privileged users
I have two processes sharing memory (via Boost Interprocess). Each process is run under a different user. The first process is run from one of our privileged users.
The second process is ran via a ...
17
votes
1
answer
2k
views
Is it wrong to think of "memfd"s as accounted "to the process that owns the file"?
https://dvdhrm.wordpress.com/2014/06/10/memfd_create2/
Theoretically, you could achieve [memfd_create()] behavior without introducing new syscalls, like this:
int fd = open("/tmp", O_RDWR | ...
1
vote
1
answer
2k
views
Change ownership of shared memory
When I run ipcs -m, I can see a list of the shared memory segments on the system, like
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
...
0
votes
1
answer
256
views
Programs started to fail suddenly with messages pertaining to shared memory
No idea why this is happening it's the first time I see this error. There seems to be enough space left in ram and drive.
First vnc fails now if I don't run it with -noshm option. Second one that ...
4
votes
1
answer
9k
views
Sharing file descriptors
If file descriptors are specific to each process (i.e. two processes may use the same file descriptor id to refer to different open files) then how is it possible to share transfer file descriptors (e....
4
votes
0
answers
1k
views
Why does `/dev/shm` on an EC2 instance have I/O throughput comparable to an EBS drive?
I recently learned about the convenient "shared memory" file system at /dev/shm. I wanted to see if I could use this to speed up a sometimes-disk-bound program that writes to and reads from a ...
0
votes
1
answer
680
views
Issues due to independent concurrent writes to shared memory
Actually I would like to know the issues caused by independent concurrent writes to shared memory.
To be more elobarote, consider we have three processes (proc1, proc2, proc3).
These 3 processes are ...
1
vote
1
answer
728
views
Interpetation of /proc/sys/kernel/shmall
Unless I am wrong. the value of /proc/sys/kernel/shmall indicates the the total amount of shared memory, in bytes, that can be allocated to the system.
I am on a t2.micro ec2 debian instance, and I ...
-2
votes
1
answer
640
views
2GB of shared memory used as shown in free [closed]
OS: Ubuntu 16.04
free output indicated about 2GB of shared memory.
The shared memory was still allocated after a logout, and no particular process from top list was occupying it.
ipcs -m did not ...
16
votes
1
answer
20k
views
Understanding mmap
I was going through documentation regarding mmap here and tried to implement it using this video.
I have a few questions regarding its implementation.
Does mmap provide a mapping of a file and return ...
10
votes
2
answers
8k
views
Where does Linux set the default values for SHMMAX?
I'm just wondering where these values are being set and what they default to? Mine is currently 18446744073692774399. I didn't set it anywhere that I can see.
$ cat /proc/sys/kernel/shmmax
...
2
votes
2
answers
4k
views
How is memory corruption handled by Linux when the process terminates?
There are many questions on Stack Overflow asking about how a system handles memory leaks and what happens on abnormal termination. Examples:
https://stackoverflow.com/questions/6727383/dynamically-...
1
vote
0
answers
241
views
How to fetch semaphores and sharedmem objects for a specific apache instance when more than one apache instances run with the same app id on the box
Not sure if the question is pertinent for this forum.
We have a server with 3 apache instances running with the "same" app/functional ID
These instances communicate with their corresponding ...
1
vote
1
answer
1k
views
Across systems, How a process communicate with other process?
I have learnt below IPC mechanisms,
BSD style half-duplex pipes
SYSV style message queues
SYSV style semaphore sets
SYSV style shared memory segments
BSD style sockets
Half-duplex pipe can be used ...
5
votes
1
answer
7k
views
How to know shared memory between two processes?
I need to know the amount of memory shared between two processes, that is, the intersection of their shared memories.
Any ideas?