Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Operating System Expert

Question: Use semaphores to synchronize the threads of customer, cook, waiter and cleaner. In your answer, specify the semaphores used in each synchronization requirement above.

Question 1: Answer the following short questions:

(a) Name two differences between logical and physical addresses.

(b) Briefly explain how the CPU uses page table in address translation.

(c) Explain why the principle of locality is crucial to the use of virtual memory.

Question 2: In a fast food restaurant there are 30 tables, each with a single seat. Three cooks prepare meal (set lunch) and append it to a queue of capacity 10. One waiter takes a meal from the queue and delivers it to a customer who has ordered a meal. One cleaner cleans the table after a customer leaves.

a) Initially there are 50 customers, but only 30 tables available. A customer must wait until a previous customer finishes the meal and his table cleaned.

b) A cook will not start preparing a meal if there is no space left in the queue.

c) When a customer orders a meal, the waiter will go to the queue, take one meal from the queue, and deliver it to the customer. The customer can then start eating.

d) When there are no orders from customers, or when the queue is empty, the waiter has to wait.

e) After a customer finishes the meal and leaves the table, the cleaner will clean the table.

Use semaphores to synchronize the threads of customer, cook, waiter and cleaner. In your answer, specify the semaphores used in each synchronization requirement above.

void customer ( ) { int myTable;

enter restaurant;

find an available table, and store the table number in myTable; sit down on table number myTable;

order meal and pay; enjoy meal;

leave restaurant;

}

void cook ( ) { while (true) {

make a meal; append to queue;
}
}

void waiter ( ) { int orderTable;
while (true) {

take a meal from the queue;

determine the table number to deliver the meal, and store it in orderTable; deliver a meal to table number orderTable;
}
}

void cleaner ( ) { while (true) {

go to the table where a customer has just finished; clean the table;
}
}

void main ( ) { parbegin waiter(); cleaner();
cook(); cook(); cook();
customer(); customer(); ... customer(); // 50 customers
parend
}

Question 3: Assume a demand paged memory management system with the following characteristics:

page size = 4K = 212 bytes physical address space = 224 bytes logical address space = 232 bytes TLB size = 26 bytes

a) How many bits are needed to specify a logical address? Give the number of bits for the page number and offset.

b) How many page table entries can fit in the TLB if each entry only contains the information need for logical to physical translation. Show your work.

c) How many page table entries are needed when a program uses its full logical address space? What is the size (in MB) of page table, assuming each PTE contains 4 control bits.

d) Part c) indicates a serious problem that arises from having a very large logical address space. What is this problem and how could an OS solve it?

Question 4: Consider a simple segmentation system that has the following segment table:

Starting Address

Length (Bytes)

660

248

1752

422

222

198

996

604

For each of the following logical addresses ([segment number, offset]), determine the physical address or indicate if a segment fault occurs:
a) [0, 198]

b) [2, 156]

c) [1, 530]

Question 5: In a 64-bit machine, suppose we divide the logical address into multilevel paging as follows:

18 bits

15 bits

15 bits

16 bits

In other words, the system has a 3-level page table, such that the first 18-bits are for the first level, the next 15-bits are for the second level, etc. In this system, 15-bits are used to represent the frame number. Assume that the memory is accessed in bytes.

a) What is the page size in this system?

b) What is the maximum number of pages that can exist for a process?

c) What is the maximum size of the logical address?

d) What is the maximum size of physical memory?

Operating System, Computer Science

  • Category:- Operating System
  • Reference No.:- M91543493

Have any Question?


Related Questions in Operating System

Question state the required answer precisely and then

Question : State the required answer precisely and then provide proper explanation. It is not enough to provide one- word or one-line answers. What is the purpose of the command interpreter? Why is it usually separate fr ...

Show all stepssuppose that the following processes arrive

Show all steps Suppose that the following processes arrive for execution at the times indicated. Each process will run the listed amount of time. in answering the questions, use non-preemptive scheduling and base all dec ...

Question description of lasa in this assignment you will

Question: Description of LASA: In this assignment, you will select a real-world operating system (can be for a PC, server, tablet, handheld, or embedded device). You will introduce the operating system and its components ...

Question topic computerized operating systems os are almost

Question: Topic: Computerized Operating Systems (OS) are almost everywhere. We encounter them when we use out laptop or desktop computer. We use them when we use our phone or tablet. Find articles that describes the diff ...

Taskyour job in this assignment is to create two virtual

Task Your job in this assignment is to create two Virtual machines each running a different but the latest distribution of Linux e.g. Ubuntu Server and CentOS. Each of these VM's is to offer services to a user base. The ...

State the required answer precisely and then provide proper

State the required answer precisely and then provide proper explanation. It is not enough to provide one- word or one-line answers. Briefly describe the following concepts and indicate how they are related in the context ...

Question 1answer the following questions 10 marks a

Question 1 Answer the following questions: 10 marks a. Consider the following page reference string: 3, 1, 4, 1, 2, 3, 5, 3, 2, 1, 2,5, 4, 3, 5, 2, 4,2, 5,3 Using the above page reference string display the contents of t ...

Assignment -building a multi-threaded web server using c

Assignment - Building a multi-threaded web server using C and p threads, following the model from the lecture. Your program will have one thread acting as a dispatcher thread, listening fornetwork connections with reques ...

Research types of operating systems that are currently

Research types of operating systems that are currently available and provide a scenario in which the operating system you chose would be appropriate to be used in this situation. Explain why you think the choice you made ...

Catalog course descriptionin this course students carry out

Catalog Course Description In this course students carry out independent research in a significant technical area of information, network, and computer security. The student is to investigate a technical area, research i ...

  • 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