Vous êtes sur la page 1sur 4

IPC - ASSIGNMENT Exercise 1 Implementaion of ls -l using c program execl() fork() wait() & sleep() perror() & exit() implementation

tation of cat, cp rm command

Exercise 2 Write a program to copy one named file into another named file. The two file names are given as the first two arguments to the program. Copy the file a block
Check%

!"# bytes$ at a time.

that the program has two arguments or print &'rogram need two arguments& that the first name file is readable or print &Cannot open file .... for reading& that the second file is writable or print &Cannot open file .... for writing&

Exercise 3 Write a program last that prints the last n lines of a te(t file) by n and the file name should be specified form command line input. *y default n should be !) but your program should allow an optional argument so that
last -n file.t(t

prints out the last n lines) where n is any integer. +our program should make the best use of available storage. Exercise 4 Write a program to compare two files and print out the lines where they differ. ,int% look up appropriate string and file handling library routines. This should not be a very long program. Exercise 5 Write a program to print the current directory path - number of files in that directory . ,int-getwd $ for path name - scandir $ to count

IPC - ASSIGNMENT

Exercise 6(Pipe) Setup a two-way pipe between parent and child processes in a C program i e both can send and recei!e signals Exercise 7(Pipe) "rite a # programs that will both send and messages and construct the $ollowing dialog between them %Process &' Sends the message (Are you hearing me)( %Process #' *ecei!es the message and replies (+oud and Clear( %Process &' *ecei!es the reply and then says (I can hear you too( Exercise 8 (Msg-q) ,se the programs to Send and recei!e messages o$ two di$$erent message types Place se!eral messages on the .ueue and in.uire about the state o$ the .ueue with msgctl.c Add/delete a $ew messages %using msgop.c and per$orm the in.uiry once more ,se msgctl.c to alter a message on the .ueue ,se msgctl.c to delete a message $rom the .ueue Exercise 9 (Msg-q) "rite a server program and two client programs so that the server can communicate pri!ately to each client indi!idually !ia a single message .ueue Exercise 10 shared memory & msg-q "rite # programs that will communicate both ways %i.e each process can read and write' when run concurrently !ia semaphores Exercise 11 shared memory or message queue "rite 0 programs that communicate together !ia semaphores according to the $ollowing speci$ications- sem/server.c -- a program that can communicate independently %on di$$erent semaphore trac1s' with two clients programs sem/client".c -- a program that tal1s to sem/server.c on one trac1 sem/client#.c -- a program that tal1s to sem/server.c on another trac1 to sem/client".c

IPC - ASSIGNMENT Exercise 12 (semaphore) Compile the programs semget.c2 semctl.c and semop.c and then in!estigate and understand $ully the operations o$ the $lags %access2 creation etc. permissions' you can set interacti!ely in the programs ,se the prgrams to Send and recei!e semaphores o$ 0 di$$erent semaphore tracks In.uire about the state o$ the semaphore .ueue with semctl.c Add/delete a $ew semaphores %using semop.c and per$orm the in.uiry once more ,se semctl.c to alter a semaphore ,se semctl.c to delete a semaphore Exercise 13(shared memory) "rite # programs that will communicate !ia shared memory and semaphores 3ata will be e4changed !ia memory and semaphores will be used to synchronise and noti$y each process when operations such as memory loaded and memory read ha!e been per$ormed Exercise 1 (shared memory) Compile the programs shmget.c2 shmctl.c and shmop.c and then in!estigate and understand $ully the operations o$ the $lags %access2 creation etc. permissions' you can set interacti!ely in the programs ,se the prgrams to E4change data between two processe running as shmop.c In.uire about the state o$ shared memory with shmctl.c ,se semctl.c to loc1 a shared memory segment ,se semctl.c to delete a shared memory segment Exercise 1! ("i#e ha$d#i$g) %ap to #oc& a$y 'i#e ( u$#oc& the 'i#e) Exercise 1* socket$ ays

Write # programs T012312.C - TC4I15T.C that will Chat both i.e each process can read and write$ at same time through connection based protocol. Exercise 1! socket$

Write # programs 6012312.C - 6C4I15T.C that will Chat both i.e each process can read and write$ at same time through connection less protocol.

ays

IPC - ASSIGNMENT Exercise 1" Threads$

Write a program that will have t o threads read - write. Where read $ thread takes a string - write $ thread writes that name using thread synchroni7ation.

Vous aimerez peut-être aussi