Find Jobs
Hire Freelancers

Cosumer--Producer problem

$30-5000 USD

Completed
Posted about 21 years ago

$30-5000 USD

Paid on delivery
there is anexample of the cosumer and producer Write a program in C++ and Win32 API to implement the producer-consumer problem . You should implement the buffer pool using two queues (i.e. linked lists): the full queue and the empty queue. The full queue contains those nodes with an item (an integer) already deposited in them (the queue is initialized to 0). The empty queue contains those empty nodes and is initialized to 10. The producer thread first asks the user to enter an integer (0..9). It then accesses the empty queue to get an empty node from the head of the queue and deposits the item in it. It then accesses the full queue to insert the node at the tail of the queue. The consumer thread accesses the full queue to get a full node from the head of the queue and removes the item from it. It then accesses the empty queue to insert the node at the tail of the queue. Since both queues can be accessed by the two threads simultaneously, synchronization (implemented using three semaphores) is needed. The "full" semaphore (initialized to 0) is used to indicate how many full buffers have been created. The "empty" semaphore (initialized to 10) is used to indicate how many empty buffers are available. The "mutex" semaphore is used to synchronize the access to the buffer pool. The following events should be addressed by sending a message to the screen. When an empty buffer is obtained by the producer thread from the empty queue. e.g. producer: an empty buffer is obtained from the empty queue. (2) When a loaded buffer is returned to the full queue. e.g. producer: buffer containing 3 is returned to the full queue. When a loaded buffer is obtained by the consumer thread from the full queue. e.g. consumer: buffer containing 5 is obtained from the full queue. (4) When an empty buffer is returned to the empty queue. e.g. consumer: an empty buffer is returned to the empty queue. You may delay the consumer (e.g. Sleep(2000)) a little bit to offset the competition between the two threads. example see attachment ## Deliverables 1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. 3) Complete ownership and distribution copyrights to all work purchased. ## Platform xp,nt,98,melinum usualy i use visual c++ 6.0
Project ID: 2917304

About the project

6 proposals
Remote project
Active 21 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
See private message.
$21.25 USD in 14 days
5.0 (78 reviews)
5.2
5.2
6 freelancers are bidding on average $45 USD for this job
User Avatar
See private message.
$25.50 USD in 14 days
5.0 (53 reviews)
5.1
5.1
User Avatar
See private message.
$42.50 USD in 14 days
5.0 (41 reviews)
4.3
4.3
User Avatar
See private message.
$51 USD in 14 days
5.0 (19 reviews)
3.2
3.2
User Avatar
See private message.
$85 USD in 14 days
5.0 (8 reviews)
2.3
2.3
User Avatar
See private message.
$42.50 USD in 14 days
5.0 (6 reviews)
2.0
2.0

About the client

Flag of UNITED STATES
United States
5.0
73
Member since Sep 7, 2001

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.