fb
$20 Bonus + 25% OFF
$20 Bonus + 25% OFF
Securing Higher Grades Costing Your Pocket? Book Your Assignment at The Lowest Price Now!
loader
Add File

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Stuck on Your Question?

Get 24x7 live help from our Top Tutors. All subjects covered.

250 words

Error goes here

Students Who Viewed This Also Studied

15 Pages
info 1113 system analysis and design

1.Follow the project plan template provided2.Develop MS Project plan (Ganttchart), critical path and project network should be highlighted.3.Develop DFD diagram with UML for the required project4.Deve ...

Course

info1113

Type

Programming

Subject

Programing

University

Kwantlen Polytechnic University

0 Page
ITPR6.500 Advanced Object Oriented Programming

...

Type

Programming

Subject

Programing

4 Pages
IST 321 System Analysis

Break the group up into smaller groups to each work on a part of the project Chandra – calculator implementation Yuriy – calculator implementation Create a way for people to enter their gr ...

Course

IST 321

Type

Programming

Subject

Programing

University

Adler University

6 Pages
COMP2132:: Web Development Javascript

OBJECTIVEUse jQuery to build an interactive e-commerce product pageREQUIREMENTSUse the files provided withassignment06_start.zipto get started. The HTML will requirescript tags to apply the jQuery lib ...

Course

COMP2132

Subject

Programing

University

British Columbia Institute of Technology

Comp604 operating system

Question

Answered

Task 1: The Buffer (or Buffer.java)
Internally, the buffer will consist of a fixed-size array of type buffer_item (which will be defined using a typedef). The array of buffer_item objects will be manipulated as a circular queue. The definition of buffer_item, along with the size of the buffer, can be stored in a Java class file or C header file such as the following:
Example snippet of buffer.h or constant.java file
  /* buffer.h */              // Java: constant.java   typedef int buffer_item;       // Java: omit it in Java or use                                   //       wrapper class
  #define BUFFER_SIZE 5;       // Java: public static final                                   //       int BUFFER_SIZE = 5
 
The buffer will be manipulated with two functions, insert_item() and remove_item(), which are called by the producer and consumer threads, respectively. A skeleton outlining these functions appears as:
Example snippet of buffer.c or buffer.java file
#include <buffer.h> //Java: import  
/* the buffer */
 
buffer_item buffer[BUFFER_SIZE];
 
int insert_item(buffer_item item) {
/* insert item into buffer return 0 if successful, otherwise
return -1 indicating an error condition */

int remove_item(buffer_item *item) {
 
/* remove an object from buffer  return 0 if successful, otherwise
return -1 indicating an error condition */
}
 
The insert_item() and remove_item() functions will synchronize the producer and consumer using the algorithms outlined in the lecture slides. The buffer will also require an initialization code section (which is part of the main() function) that initializes the empty, full, and mutex semaphores.
      
Task 2: The main() Function (or Main.java)
 
The main() function will initialize the buffer and create the separate producer and consumer threads. Once it has created the producer and consumer threads, the main () function will sleep for a period of time and, upon awakening, will terminate the application. The main () function will be passed three parameters on the command line:
1.How long to sleep before terminating
2.The number of producer threads
3.The number of consumer threads A skeleton for this function appears as:
Example snippet of buffer.c or Main.java file
#include <buffer.h>
int main(int argc, char *argv[]) { //Java: public static void                                    //     main(String[] args)
/* 1. Get command line arguments argv[1], argv[2], argv[3]*/ 
/* 2. Initialize buffer */
/* 3. Create producer threads */
/* 4. Create consumer threads */
/* 5. Sleep */
/* 6. Exit */
 
 
Task 3: Producer and Consumer Threads (or Producer.java and Consumer.java)
 
The producer thread will alternate between sleeping for a random period of time (1ms to maximum 1000 ms) and inserting a random integer into the buffer. Random numbers will be produced using the rand()function, which produces random integers between 0 and RAND_MAX (Java: Math.random()). The consumer will also sleep for a random period of time (1ms to maximum 1000 ms) and, upon awakening, will attempt to remove an item from the buffer.
Please print the following for both consumer and producer threads

Comp604 operating system

Answer in Detail

Solved by qualified expert

Get Access to This Answer

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Hac habitasse platea dictumst vestibulum rhoncus est pellentesque. Amet dictum sit amet justo donec enim diam vulputate ut. Neque convallis a cras semper auctor neque vitae. Elit at imperdiet dui accumsan. Nisl condimentum id venenatis a condimentum vitae sapien pellentesque. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere. Et ultrices neque ornare aenean euismod. Suscipit tellus mauris a diam maecenas sed enim. Potenti nullam ac tortor vitae purus faucibus ornare. Morbi tristique senectus et netus et malesuada. Morbi tristique senectus et netus et malesuada. Tellus pellentesque eu tincidunt tortor aliquam. Sit amet purus gravida quis blandit. Nec feugiat in fermentum posuere urna. Vel orci porta non pulvinar neque laoreet suspendisse interdum. Ultricies tristique nulla aliquet enim tortor at auctor urna. Orci sagittis eu volutpat odio facilisis mauris sit amet.

Tellus molestie nunc non blandit massa enim nec dui. Tellus molestie nunc non blandit massa enim nec dui. Ac tortor vitae purus faucibus ornare suspendisse sed nisi. Pharetra et ultrices neque ornare aenean euismod. Pretium viverra suspendisse potenti nullam ac tortor vitae. Morbi quis commodo odio aenean sed. At consectetur lorem donec massa sapien faucibus et. Nisi quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Duis at tellus at urna condimentum mattis pellentesque. Vivamus at augue eget arcu dictum varius duis at. Justo donec enim diam vulputate ut. Blandit libero volutpat sed cras ornare arcu. Ac felis donec et odio pellentesque diam volutpat commodo. Convallis a cras semper auctor neque. Tempus iaculis urna id volutpat lacus. Tortor consequat id porta nibh.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Hac habitasse platea dictumst vestibulum rhoncus est pellentesque. Amet dictum sit amet justo donec enim diam vulputate ut. Neque convallis a cras semper auctor neque vitae. Elit at imperdiet dui accumsan. Nisl condimentum id venenatis a condimentum vitae sapien pellentesque. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere. Et ultrices neque ornare aenean euismod. Suscipit tellus mauris a diam maecenas sed enim. Potenti nullam ac tortor vitae purus faucibus ornare. Morbi tristique senectus et netus et malesuada. Morbi tristique senectus et netus et malesuada. Tellus pellentesque eu tincidunt tortor aliquam. Sit amet purus gravida quis blandit. Nec feugiat in fermentum posuere urna. Vel orci porta non pulvinar neque laoreet suspendisse interdum. Ultricies tristique nulla aliquet enim tortor at auctor urna. Orci sagittis eu volutpat odio facilisis mauris sit amet.

Tellus molestie nunc non blandit massa enim nec dui. Tellus molestie nunc non blandit massa enim nec dui. Ac tortor vitae purus faucibus ornare suspendisse sed nisi. Pharetra et ultrices neque ornare aenean euismod. Pretium viverra suspendisse potenti nullam ac tortor vitae. Morbi quis commodo odio aenean sed. At consectetur lorem donec massa sapien faucibus et. Nisi quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Duis at tellus at urna condimentum mattis pellentesque. Vivamus at augue eget arcu dictum varius duis at. Justo donec enim diam vulputate ut. Blandit libero volutpat sed cras ornare arcu. Ac felis donec et odio pellentesque diam volutpat commodo. Convallis a cras semper auctor neque. Tempus iaculis urna id volutpat lacus. Tortor consequat id porta nibh.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Hac habitasse platea dictumst vestibulum rhoncus est pellentesque. Amet dictum sit amet justo donec enim diam vulputate ut. Neque convallis a cras semper auctor neque vitae. Elit at imperdiet dui accumsan. Nisl condimentum id venenatis a condimentum vitae sapien pellentesque. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere. Et ultrices neque ornare aenean euismod. Suscipit tellus mauris a diam maecenas sed enim. Potenti nullam ac tortor vitae purus faucibus ornare. Morbi tristique senectus et netus et malesuada. Morbi tristique senectus et netus et malesuada. Tellus pellentesque eu tincidunt tortor aliquam. Sit amet purus gravida quis blandit. Nec feugiat in fermentum posuere urna. Vel orci porta non pulvinar neque laoreet suspendisse interdum. Ultricies tristique nulla aliquet enim tortor at auctor urna. Orci sagittis eu volutpat odio facilisis mauris sit amet.

Tellus molestie nunc non blandit massa enim nec dui. Tellus molestie nunc non blandit massa enim nec dui. Ac tortor vitae purus faucibus ornare suspendisse sed nisi. Pharetra et ultrices neque ornare aenean euismod. Pretium viverra suspendisse potenti nullam ac tortor vitae. Morbi quis commodo odio aenean sed. At consectetur lorem donec massa sapien faucibus et. Nisi quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Duis at tellus at urna condimentum mattis pellentesque. Vivamus at augue eget arcu dictum varius duis at. Justo donec enim diam vulputate ut. Blandit libero volutpat sed cras ornare arcu. Ac felis donec et odio pellentesque diam volutpat commodo. Convallis a cras semper auctor neque. Tempus iaculis urna id volutpat lacus. Tortor consequat id porta nibh.

17 More Pages to Come in This Document. Get access to the complete answer.

MyAssignmenthelp.com has gained immense popularity by providing top-notch quality CDR writing services to students of the USA who want a lucrative engineering career in Australia. Specifically for delivering CDR reports, we have built robust teams of CDR writers mainly operational in Washington, D.C, New York City and Chicago. Our writers are committed to craft best in class and remarkable CDR assignment help. Students can easily buy assignments solutions from our experts who have years of experience to craft CDR assignments.

More Comp604 Comp604 operating system : Questions & Answers

Q
icon

We aren't endorsed by this University

1.Follow the project plan template provided2.Develop MS Project plan (Ganttchart), critical path and project network should be highlighted.3.Develop DFD diagram with UML for the required project4.Develop E-R diagram with UML for the required project 5.Create project prototype for the required projec ...

View Answer
Q

...

View Answer
Q
icon

We aren't endorsed by this University

Break the group up into smaller groups to each work on a part of the project Chandra – calculator implementation Yuriy – calculator implementation Create a way for people to enter their grocery list in (or maybe even tap to select items for the grocery list instead of just typing the nam ...

View Answer
Q
icon

We aren't endorsed by this University

OBJECTIVEUse jQuery to build an interactive e-commerce product pageREQUIREMENTSUse the files provided withassignment06_start.zipto get started. The HTML will requirescript tags to apply the jQuery library and yourassignment Javascriptfile, but otherwiseno further changes should need to be made to ei ...

View Answer

Content Removal Request

If you are the original writer of this content and no longer wish to have your work published on Myassignmenthelp.com then please raise the content removal request.

Choose Our Best Expert to Help You

expert
student rating student rating student rating student rating student rating
Chew Soo

Pursuing PhD in Biology with Specialization in Medicine

3812 - Completed Orders

Hire Me
expert
student rating student rating student rating student rating student rating
Griffiths Bradford

Master’s in Law from Columbia University.

650 - Completed Orders

Hire Me
expert
student rating student rating student rating student rating student rating
Jovani Dickson

doctorate degree from the same institution.

950 - Completed Orders

Hire Me
expert
student rating student rating student rating student rating student rating
Mason Morales

PhD with specialization in Behavioural Economics

2271 - Completed Orders

Hire Me

Still in Two Minds? The Proof is in Numbers!

33845 Genuine Reviews With a Rating of 4.9/5.

student rating student rating student rating student rating student rating
04 Dec 2021

English

Assignment: 2 Pages, Deadline: 25 days

My assignment scored off the charts. Thank you for your help to accomplish what I couldn\\'t do on my own. Your work and efforts has been an amazing ...

flag User ID: 6***28 Tarboro, United States

student rating student rating student rating student rating student rating
04 Dec 2021

Management

Assignment: 2 Pages, Deadline: 1 day

he assignment was well done. ThanksThe content was accurate and the structure was to the best.

flag User ID: 6***26 Canada

student rating student rating student rating student rating student rating
04 Dec 2021

Medical

Assignment: 5 Pages, Deadline: 5 days

excellent I had exactly what i want The presentation is clearthanks very much .....

flag User ID: 7***16 United Arab Emirates

student rating student rating student rating student rating student rating
04 Dec 2021

Management

Programming: 10 Pages, Deadline: 11 days

good and precise, i liked the communication between the expert and myself and also the customer reps

flag User ID: 8***57 United Kingdom, Great Britain

student rating student rating student rating student rating student rating
04 Dec 2021

Nursing

Assignment: 2.8 Pages, Deadline: 2 days

Well done. followed the rubric and answered all questions well. Plagiarism free work.

flag User ID: 7***52 Australia

student rating student rating student rating student rating student rating
04 Dec 2021

Maths

Home Work: 0 Pages, Deadline: 5 days

Really fast return, great work and brilliant response. Thank you i really appreciate it and will use again.

flag User ID: 8***15 United Kingdom, Great Britain

student rating student rating student rating student rating student rating
04 Dec 2021

It Write Up

Essay: 2 Pages, Deadline: 22 hours

expert finish the assignment on the time. Looks the assignment meet the requirement as per my request.

flag User ID: 5***87 Malaysia

student rating student rating student rating student rating student rating
03 Dec 2021

Marketing

Assignment: 12 Pages, Deadline: 2 days

very very good. also very willing to help out with escalations and reviewing the assignment for me.

flag User ID: 8***21 Singapore

student rating student rating student rating student rating student rating
03 Dec 2021

Marketing

Assignment: 6 Pages, Deadline: 7 days

The assignment provided was great. i had given one less start because the assignment is still not graded

flag User ID: 8***14 Mississauga, Canada

student rating student rating student rating student rating student rating
03 Dec 2021

Assignment

Essay: 2 Pages, Deadline: 4 days

Hi Thank you so much for your help today i got very high score I am so happy thanks again

flag User ID: 2***93 Melbourne, Australia

student rating student rating student rating student rating student rating
04 Dec 2021

English

Assignment: 2 Pages, Deadline: 25 days

My assignment scored off the charts. Thank you for your help to accomplish what I couldn\\'t do on my own. Your work and efforts has been an amazing ...

flag User ID: 6***28 Tarboro, United States

student rating student rating student rating student rating student rating
04 Dec 2021

Management

Assignment: 2 Pages, Deadline: 1 day

he assignment was well done. ThanksThe content was accurate and the structure was to the best.

flag User ID: 6***26 Canada

student rating student rating student rating student rating student rating
04 Dec 2021

Medical

Assignment: 5 Pages, Deadline: 5 days

excellent I had exactly what i want The presentation is clearthanks very much .....

flag User ID: 7***16 United Arab Emirates

student rating student rating student rating student rating student rating
04 Dec 2021

Management

Programming: 10 Pages, Deadline: 11 days

good and precise, i liked the communication between the expert and myself and also the customer reps

flag User ID: 8***57 United Kingdom, Great Britain

student rating student rating student rating student rating student rating
04 Dec 2021

Nursing

Assignment: 2.8 Pages, Deadline: 2 days

Well done. followed the rubric and answered all questions well. Plagiarism free work.

flag User ID: 7***52 Australia

student rating student rating student rating student rating student rating
04 Dec 2021

Maths

Home Work: 0 Pages, Deadline: 5 days

Really fast return, great work and brilliant response. Thank you i really appreciate it and will use again.

flag User ID: 8***15 United Kingdom, Great Britain

student rating student rating student rating student rating student rating
04 Dec 2021

It Write Up

Essay: 2 Pages, Deadline: 22 hours

expert finish the assignment on the time. Looks the assignment meet the requirement as per my request.

flag User ID: 5***87 Malaysia

student rating student rating student rating student rating student rating
03 Dec 2021

Marketing

Assignment: 12 Pages, Deadline: 2 days

very very good. also very willing to help out with escalations and reviewing the assignment for me.

flag User ID: 8***21 Singapore

student rating student rating student rating student rating student rating
03 Dec 2021

Marketing

Assignment: 6 Pages, Deadline: 7 days

The assignment provided was great. i had given one less start because the assignment is still not graded

flag User ID: 8***14 Mississauga, Canada

student rating student rating student rating student rating student rating
03 Dec 2021

Assignment

Essay: 2 Pages, Deadline: 4 days

Hi Thank you so much for your help today i got very high score I am so happy thanks again

flag User ID: 2***93 Melbourne, Australia

5% Cashback

On APP - grab it while it lasts!

Download app now

*Offer eligible for first 3 orders ordered through app!

ribbon
callback request mobile
Have any Query?