[Solved] CECS326 Homework 10

$25

File Name: CECS326_Homework_10.zip
File Size: 178.98 KB

SKU: [Solved] CECS326 Homework 10 Category: Tag:
5/5 - (1 vote)

Chapter 8

Purpose: A PROGRAMMING assignment to gain experience with signals and semaphors.

You will build an intersection control system.

Create and initialize a semaphore before you fork. Print the semaphor ID.

After the fork, the child handles traffic in the N/S direction; the parent handles traffic in the E/W direction. Both try to get their cars into the intersection as soon as possible.

Handling of the intersection must proceed as follows:

  • get a lock on the intersection
  • print N/S car entering intersection (or E/W car if youre the parent).
  • Sleep 1 seconds, this time represents how long it takes to cross the intersection.
  • print N/S car leaving intersection
  • release the lock on the intersection

Both the parent and the child should loop until they have gotten 10 cars across the intersection (i.e., loop 10 times).

Demo: Your traffic control program. The instructor will also want to look at the code.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CECS326 Homework 10
$25