A connection is point to point in the sense that it

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: nd then consumes the item by printing a message. For example: unix> ./prodconsn produced 0 produced 1 consumed 0 produced 2 consumed 1 consumed 2 produced 3 produced 4 consumed 3 consumed 4 Homework Problem 11.10 [Category 3]: Write a barrier synchronization package, with the same interface as the package in Figure 11.22, that uses semaphores instead of Pthreads mutex and condition variables. Write a driver program barriermain.c that tests your barrier routine. The driver accepts a command line argument Ò, calls the barrier init function, and then creates Ò threads that repeatedly synchronize by printing a message and calling the barrier. For example, unix> 1026: 2051: 1026: 2051: ./barrier 2 hello from barrier hello from barrier hello from barrier hello from barrier 0 0 1 1 602 1026: 2051: 1026: 2051: 1026: 2051: hello hello hello hello hello hello from from from from from from barrier barrier barrier barrier barrier barrier CHAPTER 11. CONCURRENT PROGRAMMING WITH THREADS 2 2 3 3 4 4 Homework Problem 11.11 [Category 3]: Implement a threaded version of the C fgets function, called...
View Full Document

Ask a homework question - tutors are online