Skip to main content

Questions tagged [shared-memory]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
58 views

What is the contribution of API to the memory usage of a process in linux as shown by pmap command?

I am trying to understand the memory usage of my program excluding the contribution of custom made API that creates and attaches to shared memory segment. Following is the API code. I have included ...
Soumajit's user avatar
2 votes
0 answers
45 views

Which consistency guarantees do POSIX shared memory objects have?

On Linux, POSIX shared memory objects [1] use a tmpfs via /dev/shm. A tmpfs in turn is said to "live completely in the page cache" [2] (I'm assuming swap has not been enabled). I am ...
Philipp Friese's user avatar
0 votes
0 answers
24 views

Impact of using SHM_HUGE_1GB for a size much smaller than 1GB (say, 64MB)

I'm relatively new to actually using (not understanding) a shared memory in Linux. I'm dealing with the situation now where I need to allocate a contiguous chunk of shared 64MB memory. While picking ...
Gwangmu Lee's user avatar
0 votes
1 answer
52 views

Can mmap be used to create a file which references memory subset of another file?

I'm interested in writing a program that can create two files, second file would be a "view" of first file and if modified, the first file would also be modified. Is this possible to do with ...
trickingLethargy's user avatar
0 votes
0 answers
23 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 ...
Peter T.'s user avatar
  • 123
0 votes
2 answers
338 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 ...
bgfvdu3w's user avatar
  • 115
0 votes
0 answers
58 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 -...
Betty's user avatar
  • 1
1 vote
1 answer
2k 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 ...
ThreadFrank's user avatar
0 votes
1 answer
2k 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 ...
Sanad Abughoush's user avatar
0 votes
1 answer
191 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 ...
John adams's user avatar
0 votes
1 answer
203 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 ...
John adams's user avatar
0 votes
1 answer
362 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 ...
John adams's user avatar
1 vote
1 answer
123 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 ...
GuzZzt's user avatar
  • 33
0 votes
1 answer
820 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 ...
glasstea's user avatar
0 votes
0 answers
311 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 ...
LINux's user avatar
  • 1
2 votes
1 answer
564 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 ...
Tobias Reich's user avatar
0 votes
1 answer
64 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 ...
Vovin's user avatar
  • 103
0 votes
1 answer
701 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 ...
AAA's user avatar
  • 207
1 vote
2 answers
2k 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: ...
user997112's user avatar
  • 1,025
1 vote
1 answer
6k 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 ...
unixgeek's user avatar
1 vote
1 answer
3k 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 ...
Blackwood's user avatar
  • 283
0 votes
0 answers
127 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 ...
Aryaman Gupta's user avatar
0 votes
0 answers
83 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 ...
Martian2020's user avatar
  • 1,187
2 votes
1 answer
178 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/...
wothke's user avatar
  • 21
5 votes
1 answer
3k 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 ...
martsraits's user avatar
0 votes
1 answer
2k 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 ...
schil227's user avatar
  • 103
1 vote
1 answer
813 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 ...
RTC222's user avatar
  • 125
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 ...
Tim's user avatar
  • 103k
0 votes
0 answers
227 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 ...
RTC222's user avatar
  • 125
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 ...
Kristianmitk's user avatar
3 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 ...
VladimirXRO's user avatar
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 ...
LouisXW's user avatar
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 ...
Geoffrey Anderson's user avatar
4 votes
2 answers
9k 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 ...
Tim's user avatar
  • 103k
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 ...
phg's user avatar
  • 1,827
2 votes
1 answer
837 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 ...
Micrified's user avatar
  • 143
2 votes
1 answer
3k 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 : ...
D4RIO's user avatar
  • 1,576
1 vote
0 answers
871 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 ...
user997112's user avatar
  • 1,025
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 | ...
sourcejedi's user avatar
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 ...
John's user avatar
  • 13
0 votes
1 answer
276 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 ...
C.Astraea's user avatar
4 votes
1 answer
10k 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....
benjimin's user avatar
  • 153
6 votes
1 answer
2k 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 ...
James's user avatar
  • 161
0 votes
1 answer
721 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 ...
Karthick's user avatar
1 vote
1 answer
761 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 ...
pkaramol's user avatar
  • 2,869
-2 votes
1 answer
689 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 ...
IljaBek's user avatar
  • 123
16 votes
1 answer
23k 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 ...
john 's user avatar
  • 283
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 ...
Evan Carroll's user avatar
  • 31.6k
2 votes
2 answers
5k 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-...
Arnold's user avatar
  • 23
1 vote
0 answers
261 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 ...
Meeaz's user avatar
  • 9