Find Jobs
Hire Freelancers

Producer-consumer Problem using C/C++ and Pthread APIs

$30-250 USD

ที่ทำเสร็จแล้ว
โพสต์ เกือบ 6 ปีที่ผ่านมา

$30-250 USD

ชำระเงินเมื่อส่งงาน
1 Producer-consumer Problem using C/C++ and Pthread APIs (NOT Thread-safe) Implement a simple producer/consumer program using POSIX threads. You are to design the threads to run with a preemptive scheduler (note: Each call to pthread_create() will create a kernel thread on Linux and all kernel threads will be run with a preemptive scheduler on Linux) and to communicate through a bounded buffer. Design the buffer to have 10 slots. - DO NOT use mutex or semaphore at all! - Design the shared buffer to have 10 slots: o Use an integer array to hold the contents of the buffer o Use a counter variable to hold the number of occupied cells o Use a variable to keep track of the next location for the producer to insert a value o Use a variable to keep track of the next location for the consumer to remove a value. o Do not forget to initialize the counter and the two variables. - Implement the bounded shared buffer in a way that is NOT thread-safe, not protecting the update of the counter or the two variables. - Only one producer thread and only one consumer thread will be created in addition to the main thread. - The producer thread should send a sequence of integers to the consumer. Specifically, it should send the sequence 1, 2, 3, ..., 1000000, in that order by inserting each value in order to the shared buffer. In case that the buffer is full, it should do busy waiting using a while loop. Once all the values have been inserted, the producer thread should call pthread_exit(); - The consumer thread should receive them and check that it has indeed received exactly that sequence, in that order. If you should expect that something will go wrong. The consumer should discover that the numbers received are not in the correct sequence. As soon as the consumer sees an error, it should report how much of the sequence was received correctly, and what the next (incorrect) number was. - You don’t have to create separate functions for insert_item() and remove_item(). [Sample run] % ./producer_consumer1 ERROR: The consumer received the sequence up to 12000 correctly. The next number (incorrect) number was 12004. Requirements: • Makefile should be provided. • The name of the executable file should be “producer_consumer1”. Deliverables: source code, Makefile, a writeup in a separate file (in plain text format; NO PDF or MS-word or ODT format!)
รหัสโปรเจกต์: 16761358

เกี่ยวกับโปรเจกต์

4 ข้อเสนอ
โปรเจกต์ระยะไกล
ใช้งานอยู่ 6 ปีที่ผ่านมา

กำลังมองหาการสร้างรายได้ใช่ไหม?

ประโยชน์ของการประมูลกับ Freelancer

กำหนดงบประมาณและกรอบเวลาของคุณ
รับเงินจากการงานของคุณ
อธิบายข้อเสนอของคุณในภาพรวม
ลงทะเบียนและเสนอราคาฟรี
หมอบหมายให้:
รูปอวาตาร์ของผู้ใช้
hi..i am good at core inter process communication in C using posix threads and can help you write the producer/consume program. please contact me as soon as possible to discuss the project further.
$60 USD ใน 2 วัน
4.9 (49 รีวิว)
5.2
5.2
4 freelancers are bidding on average $93 USD for this job
รูปอวาตาร์ของผู้ใช้
Hi, sir I am very interested in your project. I have experience with 9 years. And also I'm very lucky so your project will be completed finely in the shortest time. Please send me message and discuss more. Thanks for your project. And waiting your reply. Best regards.
$150 USD ใน 3 วัน
5.0 (17 รีวิว)
4.9
4.9
รูปอวาตาร์ของผู้ใช้
Hi, I have implemented many such project (both pthread and OS) including the producer consumer. no upfront required, you need to create milestone only that will be released on completion Regards, Surbhi
$61 USD ใน 3 วัน
5.0 (2 รีวิว)
1.5
1.5
รูปอวาตาร์ของผู้ใช้
I have solved this kinds of problems before. I am also familiar with posix thread. Let me know if you want me for this job.
$100 USD ใน 3 วัน
5.0 (1 รีวิว)
0.8
0.8

เกี่ยวกับลูกค้า

ปักธงของ UNITED STATES
champaign, United States
5.0
1
ยืนยันวิธีการชำระเงินแล้ว
เป็นสมาชิกตั้งแต่ เม.ย. 4, 2018

การยืนยันลูกค้า

ขอบคุณ! เราได้ส่งลิงก์สำหรับเครดิตฟรีให้คุณทางอีเมลแล้ว
เกิดข้อผิดพลาดขณะส่งอีเมลของคุณ กรุณาลองอีกครั้ง
โลโก้ Freelancer Thailand / ภาษาไทย ช่วยเหลือและสนับสนุน FreelancerประเภทโปรเจคการประกวดFreelancerองค์กรแพ็กเกจสมาชิกโครงการ Freelancer ชั้นแนวหน้าการจัดการโปรเจคงานในพื้นที่Photo Anywhereหน้าจัดแสดงผลงานAPI สำหรับนักพัฒนาได้รับการยืนยันDesktop App เกี่ยวกับเกี่ยวกับเราวิธีใช้งานความปลอดภัยนักลงทุนแผนผังเว็บไซต์เรื่องราวข่าวออกสื่อทีมรางวัลข่าวประชาสัมพันธ์ร่วมงานกับเรา ข้อกำหนดนโยบายความเป็นส่วนตัวข้อกำหนดและเงื่อนไขนโยบายลิขสิทธิ์ข้อพึงปฏิบัติค่าธรรมเนียมและค่าบริการหุ้นส่วนEscrow.comLoadshiftWarrior Forum แอปโลโก้ Apple App Store โลโก้ Google Play
ไม่สามารถคัดลอกไปยังคลิปบอร์ดได้ โปรดลองอีกครั้งหลังปรับเปลี่ยนการอนุญาต
คัดลอกไปยังคลิปบอร์ดแล้ว
ผู้ใช้ที่ลงทะเบียน งานที่มีการโพสต์ทั้งหมด
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
กำลังโหลดตัวอย่าง
ได้รับอนุญาตสำหรับตำแหน่งทางภูมิศาสตร์
เซสชั่นการเข้าสู่ระบบของคุณหมดอายุและคุณได้ออกจากระบบแล้ว กรุณาเข้าสู่ระบบอีกครั้ง