Click here to Skip to main content
15,891,431 members
Home / Discussions / System Admin
   

System Admin

 
GeneralRe: Run my process on sytem Start up Pin
Michael Dunn22-Mar-05 9:05
sitebuilderMichael Dunn22-Mar-05 9:05 
GeneralRe: Run my process on sytem Start up Pin
Anonymous23-Mar-05 4:02
Anonymous23-Mar-05 4:02 
GeneralRe: Run my process on sytem Start up Pin
Mekong River23-Feb-06 20:42
Mekong River23-Feb-06 20:42 
QuestionHow OS updates the display? Pin
WebPartsStart20-Mar-05 17:57
WebPartsStart20-Mar-05 17:57 
AnswerRe: How OS updates the display? Pin
Christian Graus20-Mar-05 18:08
protectorChristian Graus20-Mar-05 18:08 
AnswerRe: How OS updates the display? Pin
TOMCAT8120-Mar-05 18:48
TOMCAT8120-Mar-05 18:48 
AnswerRe: How OS updates the display? Pin
Mekong River23-Feb-06 20:54
Mekong River23-Feb-06 20:54 
Generalre:help me out its on win32 Pin
pradeep reddy20-Mar-05 0:10
pradeep reddy20-Mar-05 0:10 
Assignment



Write a program in C++ and WIN32 api to implement an unnamed pipe. program should contain two threads ("producer" and "consumer") communicating through a pipe which is implmented using an array having 10 entries( ie 0 to 9). access to the pipe should be synchronized using a semaohore implemented as a " class" .The "p" and "v" operations supported by the semaphore should be exucuted "ATOMICALLY" Which is enforced using WIN32 API functions (e.g the createsemaphore funtion).

NOTE The P and V are the only operations supported by the semaphore class.


The poducer thread gets an integer ( a single digi, 0.....9) from the user and enqueues it into the pipe . The consumer thread always dequeues the first number in the pipe toward the front of the pipe after an item has been deposited ( by the producer) or consumed ( by the consumer)

We should use another "class" (ie the pipe class) to implement the pipe supporting operations " enqueue", "dequeue" and "move". The fisrt two operations have to be synchronized using the semaphore shown above (operation"move " is not because it is invoked by the first two operatios which can directl acces the shared pipe)

Note that your pogram should also be able to take care of the conditions when the pipe is either empty or full.When the consumer thread detects an empty pipe ,it prints a message to the screen.similarl when the producer thread detects afull pipe ,it prints a message to the screen too.

Note also that you should alwas delay the consumer thread by three 3 seconds by inserting a "sleep3000)" (without qoutes ) function into the appropriate place in the consumer thread.

The producer thread shold also show the contents of the pipe after a number is enqueued .
The consumer shouls aslso show the contents of the pipe after a number is dequeued .


The following shows the scenario of running program, where user inputs are underlined

enter a number: 5the
contents of the pipe (from the producer):bbbbbbbbb5

enter a number:2
the contents of the pipe(from producer):bbbbbbbb25
the contents of the pipe (from consumer);bbbbbbbbb2

enter a number:7
the contents of the pipe (from producer):bbbbbbbb72
the contents of the pipe (from consumer):bbbbbbbbb7

enter a number:
the contents of a pipe ( from consumer):bbbbbbbbbb
... an empty pipe is detected (from consumer):\\\
..................






GeneralRe: re:help me out its on win32 Pin
Christian Graus20-Mar-05 18:10
protectorChristian Graus20-Mar-05 18:10 
QuestionCreate partitions on windows without a restart ?? Pin
Hesham Amin19-Mar-05 9:50
Hesham Amin19-Mar-05 9:50 
AnswerRe: Create partitions on windows without a restart ?? Pin
Mike Dimmick19-Mar-05 13:57
Mike Dimmick19-Mar-05 13:57 
GeneralRe: Create partitions on windows without a restart ?? Pin
Hesham Amin19-Mar-05 21:05
Hesham Amin19-Mar-05 21:05 
GeneralRe: Create partitions on windows without a restart ?? Pin
Mike Dimmick19-Mar-05 23:00
Mike Dimmick19-Mar-05 23:00 
AnswerRe: Create partitions on windows without a restart ?? Pin
TOMCAT8120-Mar-05 18:46
TOMCAT8120-Mar-05 18:46 
GeneralRe: Create partitions on windows without a restart ?? Pin
Hesham Amin20-Mar-05 23:06
Hesham Amin20-Mar-05 23:06 
AnswerRe: Create partitions on windows without a restart ?? Pin
albCode6-Jun-05 3:18
albCode6-Jun-05 3:18 
Questiondetect Win32 events? Pin
toduro19-Mar-05 7:13
toduro19-Mar-05 7:13 
AnswerRe: detect Win32 events? Pin
Nagendra Kamath K21-Mar-05 0:36
Nagendra Kamath K21-Mar-05 0:36 
GeneralWin XP SP2 Nightmare Pin
Kevin McFarlane17-Mar-05 10:13
Kevin McFarlane17-Mar-05 10:13 
GeneralRe: Win XP SP2 Nightmare Pin
Mekong River20-Mar-05 4:10
Mekong River20-Mar-05 4:10 
GeneralRe: Win XP SP2 Nightmare Pin
Kevin McFarlane20-Mar-05 4:36
Kevin McFarlane20-Mar-05 4:36 
GeneralClose applications Pin
ArmandoN17-Mar-05 2:28
ArmandoN17-Mar-05 2:28 
GeneralRe: Close applications Pin
Mike Dimmick19-Mar-05 14:05
Mike Dimmick19-Mar-05 14:05 
GeneralRe: Close applications Pin
Anonymous21-Mar-05 1:56
Anonymous21-Mar-05 1:56 
GeneralRe: Close applications Pin
faroqtam20-Mar-05 21:40
faroqtam20-Mar-05 21:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.