This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CSSE 340 Operating Systems Project 4: Multi-Process and Shared Memory Management Project Descriptions This project is intended to make students familiar with C/C++ programming on a UNIX/Linux system. It requires programming skills on process creation, termination and inter-process communications using shared memory. You are required to implement a small multi-process program that simulates a simple game. To set up the game, initially a base number ( base ) is assigned to 5, and then all players form a ring to play. The first player picks a random number ( rand_num ) between 1 and 10, and compares it against base . If rand_num is equal to or larger than base , then the player calls the next player for the next play and stays in the ring. If rand_num is smaller, then the player calls the next player but leaves the ring. In either case, the player always updates the base with its own rand_num . The game continues until only one player is left, and then the last player becomes the winner and the game ends. Specification and Requirement a) The initial base is set to 5; it should be stored in shared memory. b) The parent process creates child processes based on the input, num_process . The position of each process in the ring is determined in the order of its creation, i.e. the parent process is player #1 (player_id = 1), the first child process is player #2 (player_id = 2), etc. The processes use shared memory section to communicate with each other....
View Full Document
- Spring '11
- Randomness, Numeral system, player, Child process