3. Develop a program to do the follows. (30pts) a) Access a shared memory segemnt using key = ftok("/tmp", 'z'); b) Atta

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

3. Develop a program to do the follows. (30pts) a) Access a shared memory segemnt using key = ftok("/tmp", 'z'); b) Atta

Post by answerhappygod »

3. Develop a program to do the follows. (30pts) a) Access a
shared memory segemnt using key = ftok("/tmp", 'z'); b) Attach the
shared memory segment. c) Output the content of the shared memory
segment. d) Use IPC_STAT to output the value of shm_nattch, No. of
current attaches. See the strut below.
e) Detach the shared memory segment. */ struct shmid_ds { struct
ipc_perm shm_perm; /* operation perms */ int shm_segsz; /* size of
segment (bytes) */ time_t shm_atime; /* last attach time */ time_t
shm_dtime; /* last detach time */ time_t shm_ctime; /* last change
time */ unsigned short shm_cpid; /* pid of creator */ unsigned
short shm_lpid; /* pid of last operator */ short shm_nattch; /* no.
of current attaches */ /* the following are private */ unsigned
short shm_npages; /* size of segment (pages) */ unsigned long
*shm_pages; /*array of ptrs to frames -> SHMMAX*/ struct
vm_area_struct *attaches; /* descriptors for attaches */ };
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply