Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

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

Solve the problem by implementing the whole class with main

Solve the problem by implementing the whole class with main() function and demonstrate that your Java code can pass several appropriate test cases successfully in your main() function? Write a short recursive Java method ...

Answer the following questions 1 suppose we want to

Answer the following Questions : 1. Suppose we want to transmit the message 1011101110 and protect it from using the CRC polynomial x 3 + x + 1. Use polynomial long division to determine the message should be transmitted ...

This is a simple exercise to introduce the use of arrays

This is a simple exercise to introduce the use of arrays and some of the common errors that occur when programming with them in c++. • Write a simple program that allows the user to enter 10 integers into an array, then ...

What is equi-marginal principle why does it have to be true

What is Equi-marginal principle? Why does it have to be true at interior optimum?

Roberto is the network administrator for an international

Roberto is the network administrator for an international law firm with offices and customers in North America, South America, Africa, and the Middle East. The lawyers frequently contact each other via e-mail, use the In ...

Question after 1 year of launch ride sharing increased a

Question: After 1 year of launch, ride sharing increased a lot resulting in a lot of insertion requests to the database. Consider there is no room to further increase the size of server and changing database is not an op ...

You work in a veterinarians office and need to organize the

You work in a Veterinarian's office and need to organize the data on pets that you treat. In your database, you want to keep track of the following information: Customer information: Name Address City State ZIP Phone # Y ...

Consider a normally distributed set of scores with a mean

Consider a normally distributed set of scores with a mean of 0 and a standard deviation of 5. If a value of 3.25 is sampled from this distribution, what is the corresponding z-score? If necessary, round your answer to tw ...

What are the best practices to follow for microsoft windows

What are the best practices to follow for Microsoft Windows network security. Which two would you start with and why?

How does a java server page uses the client-server model to

How does a Java Server Page uses the client-server model to make a Web page interactive?

  • 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