Ask Computer Engineering Expert

Assignment 1 -

Part I - Multiple choice, True/False and fill in blank:

1) Pipes are _______ persistent and Semaphores are ________ persistent.

2) Socket: to receive messages, a UDP client can use either recv( ) or recvfrom() system calls T/F?

3) If a thread is detached then it cannot be joinable T/F?

4) When a thread waits on a condition variable, its lock on the associated mutex will be be released T/F?

5) A process is zombte for the period of time from its creation to the time the parents issues a wait on it T/F?

6) Condition variable is a signaling mechanism associated with mutex T/F?

7) Pipes: there is no need that a process has to be waiting for a message to arrive T/F?

8) Semaphore values are stored in kernel and semaphore operations are performed in kernel mode T/F?

9) The semaphore command: semct1 (semid2, ANY, SETALL, 1) does the following:

(a) sets the value of the 1st semaphore in the semaphore set semid2 to 1.

(b) sets the value of all semaphores in she semaphore set semid2 to 1

(c) sets the value of the 1st semaphore in the semaphore set semid2 to 2.

(d) sets the value of the semaphore semid2 to 1.

(e) none of the above.

10) The semaphore command: semct(semid3, 2, SETVAL, 5) does the following.

(a) set the value of the semaphore semid3 to 5.

(b) sets the value of all semaphore in semid3 to 5.

(c) sets the value of the 3rd semaphore in the semaphore set semid3 to 5.

(d) set the value of dm first two semaphores in the semaphore set semid3 to 5

(e) now of the above.

11) _______ is a connection-oriented transport layer protocol.

12) A zombie process relinquishes all its resources including its slot in the process table; T/F?

13) Private class members are accessible outside class; T/F?

14) The types int, float, double and char are called primitive types; T/F?

15) String objects in Java are immutable: they cannot be modified after they are created. T/F?

16) Variables of type int can contain either signed or unsigned values: True or False?

17) Primitive-type names are keywords and must appear in all uppercase letters; T/F?

18) What is the purpose of the keyword void when used as the return type for the main method?

19) List the primitive types in Java.

20) To overload constructors, simply provide multiple constructor declarations with differing signatures and it is allowed in Java T/F?

Part II - Answer the following questions

1) Explain briefly differences between process, kernel, filesystem, persistence and give examples.

2) What are the possible return values of fork and what does each one mean?

3) A newly created process with fork () will be associated with (will executive) which program?

4) All threads of one process share (have in common) the following items: ................... while each thread has its own (not shared) ...............................              

5) Define pthreads? (2 - 3 lines)

6) The simplified shell algorithm in UNIX is simple algorithm that accept a command from the user and executes it (as discussed in the class). User can use the symboo '&' after the command. Modify the simplified shell algorithm to handle.

7) Write a pseudo-cede for the wait and signal operations in conditions variable.

8) Write down the steps (including the system calls) to exchange information using message queues.

Assignment 2 - Programming

1) Compile and run the two multithreading programs that we discussed in the class:

(a) First one is the threads program listed on slides numbers 22-26 of Threads slides. You need to change the values of MAXNITEMS and MAXNTHREADS to smaller numbers.

(b) Program multiple producers - single consumer with mutexes and condition variables, on threads slides numbers 31-35. You can change the values of MAXNITEMS and MAXNTHREADS to smaller (and more manageable) values. Provide screen shots showing successful compile and run with sample output.

2) You need to implement multiple producers multiple consumers work together as follows:

-producers and consumers work on a shared buffer called Buff with size of 200 elements

-Multi - threading in C and Unix

-use semaphores and condition variables.

-This is individual assignment (no groups).

-Each producers fills an entry of Buff with r (where r is a random number and I <= r <=10)

-The two consumers C1 and C2 can consume from Buff as follows: -- any Buff entry with value 5 or less can be consumed by either C1 or C2

-any Buff entry with value 6 or more can be consumed by C1 if number of number is odd and by C2 if the number is even.

-record the log of how many Buff entries each producer has filled. The winner is the producer that fills the most number of entries.

-The winner of C1 and C2 is the consumer that consumes the most number of entries.

Attachment:- Assignment.rar

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91982842

Have any Question?


Related Questions in Computer Engineering

Does bmw have a guided missile corporate culture and

Does BMW have a guided missile corporate culture, and incubator corporate culture, a family corporate culture, or an Eiffel tower corporate culture?

Rebecca borrows 10000 at 18 compounded annually she pays

Rebecca borrows $10,000 at 18% compounded annually. She pays off the loan over a 5-year period with annual payments, starting at year 1. Each successive payment is $700 greater than the previous payment. (a) How much was ...

Jeff decides to start saving some money from this upcoming

Jeff decides to start saving some money from this upcoming month onwards. He decides to save only $500 at first, but each month he will increase the amount invested by $100. He will do it for 60 months (including the fir ...

Suppose you make 30 annual investments in a fund that pays

Suppose you make 30 annual investments in a fund that pays 6% compounded annually. If your first deposit is $7,500 and each successive deposit is 6% greater than the preceding deposit, how much will be in the fund immedi ...

Question -under what circumstances is it ethical if ever to

Question :- Under what circumstances is it ethical, if ever, to use consumer information in marketing research? Explain why you consider it ethical or unethical.

What are the differences between four types of economics

What are the differences between four types of economics evaluations and their differences with other two (budget impact analysis (BIA) and cost of illness (COI) studies)?

What type of economic system does norway have explain some

What type of economic system does Norway have? Explain some of the benefits of this system to the country and some of the drawbacks,

Among the who imf and wto which of these governmental

Among the WHO, IMF, and WTO, which of these governmental institutions do you feel has most profoundly shaped healthcare outcomes in low-income countries and why? Please support your reasons with examples and research/doc ...

A real estate developer will build two different types of

A real estate developer will build two different types of apartments in a residential area: one- bedroom apartments and two-bedroom apartments. In addition, the developer will build either a swimming pool or a tennis cou ...

Question what some of the reasons that evolutionary models

Question : What some of the reasons that evolutionary models are considered by many to be the best approach to software development. The response must be typed, single spaced, must be in times new roman font (size 12) an ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As