Download presentation
Presentation is loading. Please wait.
1
OS Project #1: Racing condition Multi-processing: using the fork() system call to generate many processes in UNIX. Generate [ fork()] 10 processes. zParent process prints children’s process ids Each child process print its own process id while copying 10 characters from the standard input to the standard output using read()/write() system calls.
2
OS Project #1: cont’d 1 zUsing Makefile and make statement. zWrite a shell script to automatically test your program. zNote: Read the manuals of read(), write(), fork(), getpid() system calls. ymake statement and Makefile syntax. yshell script. zHints: prepare a file that contains 100 chars, counting from ‘\001’ to ‘\100’ (decimals) as the test input
3
OS Project #1: cont’d 2 zSample output: yparent (pid 23784) forking child (pid 23792) y… ychild (pid 23812) prints char 2: [dec:23, oct:027] y… yparent (pid 23784) exiting y… ychild (pid 23812) exiting.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.