EEL 602 - Operating Systems
Spring 2007
Indian Institute of Technology Delhi, New Delhi



Assignment # 2

Process and Signals

The objective of this assignment is to let you gain some hands on experience in Unix process creation and communication.

Consider the following scenario in a cricket game/pitch:

  1. One Umpire, Team F (Fielding) consisting of 11 members, Team  B (Batting) with only one player in  the ground (Batsman).
  2. A square play-ground of dimensions 9x9 (81 blocks). The batsman stands in the center block (in front of red wickets in shown in above figure).
  3. The umpire creates a captain of team F and this captain assigns himself a place in the ground and then creates 10 players of his team, with 9 fielders positioned in distinct blocks in the ground (no two players in the same block) and 1 player who bowls.
  4. The captain informs the umpire about the bowler.
  5. The umpire creates the batsman.
  6. The umpire then instructs the bowler to release the ball.
  7. The bowler releases the ball.
  8. The batsman hits the ball.
  9. If the ball reaches in one of the blocks with a fielder in it ® Go to step 11.
  10. The score is incremented. The ball which reaches farther from the batsman fetches higher score for the team ® Go to Step 6.
  11. The fielder informs the umpire and the umpire declares the batsman out. The game ends here.

Instructions

  1. Each entity (batsman, bowler, umpire, fielders) is a process. Total 13 processes.
  2. The interaction between them is using IPC.
  3. The batsman is a user (human!).
  4. Bowler releasing the ball : IPC to batsman.
  5. Batsman hitting the ball : A random number(s) generated when the user hits a key. For example, it may be two random numbers which are x and y coordinates (block location) or some data of your convenience. In effect, the random number(s) gives the location of the ball. Note user interaction is here.
  6. Atleast two methods of IPC HAVE to be used  :  shared memory and message queues.
  7. All entities other than the batsman are automated.
  8. Umpire declaring the batsman out : batsman process being killed.
  9. The data being passed between each entity has to be decided by you. Make assumptions wherever specification is not given (make life easier!)
  10. Have fun! 

Implementation

            POSIX standard IPC mechanisms

Sample Instruction and Output

 

Umpire created.

Score Range (according to the distance from the batsman)

**********

1 blocks from the  batsman : 1 run.

2-3 blocks : 2 runs.

4 blocks : 3 runs.

Greater than 4 blocks : 4 runs.

**********

Umpire : Captain created.

 Player 1 with PID 1324 created with location 5,6.

 Player 2 with PID 8712 created with location 3,4.

....

....

....

....

Player 9 with PID 2364 created with location 8,7.

Umpire : Bowler PID received from captain.

Bowler : Ball released.

(waiting for user)

Batsman: Ball hit

Umpire: Ball in the gap, score incremented by $somevalue.

Bowler : Ball released.

(waiting for user)

Batsman: Ball hit.

Player 1: Ball caught.

Umpire:  Batsman out.

Umpire: All the players killed. Score: $somevalue. Game ends!.

Make sure you distinguish messages from various entities in the output.

 


Points Distribution  [Maximum 20]

               1)     Forking - 5%

2)     IPC between umpire and fielders (including the captain) – 30%

3)     IPC between umpire and bowler – 10%

4)     IPC between bowler and batsman –10%

5)     IPC between batsman and fielders – 30%

6)     Graceful exit – 10%

7)     Others – 5%

8)     If both the IPC mechanisms (message queues and shared memory) are not present in the implementation, then the marks obtained by the student will be halved (Maximum marks obtainable will be 10 marks). The places where the students use a particular IPC mechanism is in their own hands.

9)     Demo failure with parts of the code working will be dealt in a different manner. The grading scheme at the bottom of the page in this link is an example.

10)   Clarity, Formatting and General Layout ® Up to -10% if not followed.

11)   Originality ® Both copier and originator gets ZERO.

12)   Late Policy ® 20% reduction, allows ONLY one day delay.

Submission

Please submit a tar file on-line containing the following:

The tar file can be uploaded in assignment # 2 using this link. Please make sure that you upload the assignment only once. In case of multiple submissions, ONLY first submission will be used for grading.

Deadline

The submission deadline for the assignment # 2 is 08/02/2007 [23:59 Hrs].

Questions

If you have any further questions relating to this assignment, you may contact the TA,  S.Karthikeyan.