Fermé

Operating system -- 4

Problem Description

Consider a system with 3 smoker processes and 1 agent process. Each smoker continuously rolls a cigarette and then smokes it. The smoker needs three ingredients: tobacco, paper, and matches. One of the smokers has paper, another has tobacco, and the third has matches. The agent has an infinite supply of all three materials and (randomly) places two of the ingredients on the table each time. The smoker who has the remaining ingredient then makes and smokes a cigarette, signaling the agent on completion. The agent then puts out another two of the three ingredients, and the cycle repeats.

TO DO: ​Write ​two ​programs to synchronize the agent and smoker processes: one using ​semaphores and another using ​pthread libraries.

Instructions

•P​ lease see thislinkforpseudocode:[login to view URL]~hollings/cs412/s96/synch/[login to view URL] •T​ hough the description says the agent process can infinitely supply two ofthe three ingredients, you

can assume that the agent places ingredients only a finite number of times, say for example 10. •

Y​ou need to use the sem.h header file in your semaphore-based solution.

• Y​ou need to compile code with linker ​-pthread​ when using pthread library.

Eg: ​$ gcc -o Task6 task6.c -pthread Submission Instructions

Submit your solution to the cigarette smokers problem along with a brief report (atmost 1 page) on how your solution synchronizes the four processes. Draw comparison between semaphore and pthread library based solutions highlighting the merits and demerits of both approaches. The C solution files must be internally documented.

Compétences : Programmation C, Java, Programmation C#, Architecture Logicielle, Programmation C++

en voir plus : line number text file, free psd file header design, call retrieve number matching file, flv file header asp grab, python csv file header record, flv file header, modify file header, solidworks problem opening stp file, java sorting number text file, add installation number kickstart file, phone number csv file, perl script search number text file, extract compile file rar, innodb: operating system error number 2 in a file operation, innodb: operating system error number 23 in a file operation, mariabackup innodb: operating system error number 13 in a file operation, innodb: operating system error number 5 in a file operation

Concernant l'employeur :
( 3 commentaires ) South Ozone Park, United States

Nº du projet : #28335063

5 freelances font une offre moyenne de 37 $ pour ce travail

it2051229

Hi there, I went through your requirements and I would like to do this project if given the opportunity. I am familiar with this concept in operating system with regards to threading and synchronization. I've done proj Plus

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(1643 Commentaires)
8.0
hbxfnzwpf

I am very proficient in c/c++. I have 17 years c/c++ developing experience now, and have worked for more than 10 years. My work is online game developing, and mainly focus on server side, using c++ under Linux environm Plus

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(217 Commentaires)
7.3
kaloyan13

I can deliver to you a code with comments on every line. C is my top level skill, and I have done many simulations with processes.

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(453 Commentaires)
7.4
sheikhnazeer3

Hello, My name is Nazeer and I'm a full-time freelancer from Pakistan. I read your job offer regarding the OS task and I'm ready to start right away. I am also flexible with whatever budget you have. Accuracy and clie Plus

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(20 Commentaires)
4.2
abdulhad014

Hello there, I having been working with C C++ for more then 2 years and I have done quite a lot of tasks using Visualstudio,Eclipse,Linux Terminal since i started. I have great command in OOP,Data Structures and Algor Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 7 jours
(0 Commentaires)
0.0