Program for Inter-Process Communication using shared memory

preview_player
Показать описание
In this lecture on Program for Inter-Process Communication using shared memory, you will learn how shared memory is used for inter process communication in Linux using C language.
Shared Memory is the fastest inter-process communication (IPC) method. The operating system maps a memory segment in the address space of several processes so that those processes can read and write in that memory segment. The overview is as shown below:
Two functions:shmget() and shmat() are used for IPC using shared memory. shmget() function is used to create the shared memory segment while shmat() function is used to attach the shared segment with the address space of the process.



Reference Videos:

Tools Required:
1. Linux environment
2. Basic knowledge of C Language
3. gcc compiler installed

Reference Links:

Other Playlists:

Was this tutorial about Program for Inter-Process Communication using shared memory helpful? If so, please share. Let me know your thoughts in the comments.

#linux #oslab #os #dextutor #ipc
Рекомендации по теме
Комментарии
Автор

Excellent sir... Simplest... Yet serving the purpose...very helpful for students... Can you make video on message queues?

aninditasaha
Автор

You made the topics much much more simpler than they are actually sir.Great Explanation 🙇

tarunnaik
Автор

i guess this was the best explanation, thank you sir

bestdeal
Автор

Great explanation sir! Sir very important thing you didn't tell us. How do we clear/purge the memory occupied by the shared_memory. The first program that was the sender-program had exited. Do we need to call a function from receiver-program to delete the shared_memory?

deleater
Автор

hello sir could you tell me how to make this as full duplex communication using shared memory .
example it can take input from any 1/2nd process, and it should receive in another process

dhanrajv
Автор

Nice video. can you make IPC memory passing video?

prathapbillgates
Автор

Sir use OBS software for recording your videos has poor quality butttt.... your videos are alot informational so thank you so much !

vaibhavpallod
Автор

I am getting different key value in reciver program...written code as same .

chandinikm
Автор

Getting an error for:
error: invalid conversion from ‘void*’ to ‘char*’ [-fpermissive]
18 | strcpy(shared_memory, buff); //data written to shared memory
|
| |
| void*

ohm_chiluka
Автор

Can You Help Me This Program

Design a program that including 2 sub processes, it receives standard input, through sharing memory, the father process transmits a serial of number(>=10 )to the sub processes, after the sub processes receive the interupt signal from the father process:
1) one subprocess plus the numbers
2)the other subprocess mulitple the numbers
Then through the message queue send the result to the father process, and the father process printf the numbers.

rabiulhasan
Автор

is it possible When a process communicates with each other, the timestamp is recorded with +5 secs?

agpskalaparipaadeex
Автор

In second program in output the first program data we written is not show.. segment fault message show

rahulpawar
Автор

Did I miss something, or did you not deallocate the memory? How do you deallocate?

guidosalescalvano
Автор

Why the address for shared memory changes for sender and receiver??

chinnurpk
Автор

How do I determine how much space I need to use for the second argument of shmget? The file I'll be having the processes write to will be in the shared memory. Is 1024 bytes too little in my case (since I'll be having up to 20 processes writing a sentence to the file several times)?

Tom-fxmk
Автор

Thank you so much sir :) really helpful

ayeshaadhikari
Автор

why in the receiver program we got different address for shared memory get attached to the same memory segment then it should give the same address

abhijitkumarsinha
visit shbcf.ru