How does that function pick the next thread

Assignment Help Operating System
Reference no: EM132376264

Programming Assignment : Written Exercises

Please answer the following questions and submit them with your assignment in code-reading.txt.

Code reading

To implement synchronization primitives, you will have to understand the operation of the threading system in OS/161. It may also help you to look at the provided implementation of semaphores.

When you are writing solution code for the synchronization problems it will help if you also understand exactly what the OS/161 scheduler does when it dispatches among threads. Place the answers to the following questions in code-reading.txt.

Thread Questions

1. What happens to a thread when it exits (i.e., calls thread_exit())? What about when it sleeps?

2. What function(s) handle(s) a context switch?

3. What does it mean for a thread to be in each of the possible thread states?

4. What does it mean to turn interrupts off? How is this accomplished? Why is it important to turn off interrupts in the thread subsystem code?

5. What happens when a thread wakes up another thread? How does a sleeping thread get to run again?

Scheduler Questions

6. What function is responsible for choosing the next thread to run?

7. How does that function pick the next thread?

8. What role does the hardware timer play in scheduling? What hardware independent function is called on a timer interrupt?

Synchronization Questions

9. Describe how thread_sleep() and thread_wakeup() are used to implement semaphores. What is the purpose of the argument passed to thread_sleep()?

10. Why does the lock API in OS/161 provide lock_do_i_hold(), but not lock_get_holder()?

Synchronization Problem: Traffic Management at Podunk

You must solve this problem using the locks that you implemented above. Other solutions are not acceptable.

Traffic through the main intersection in the town of Podunk, KS has increased over the past few years. Until now the intersection has been a four-way stop but now the impending gridlock has forced the residents of Podunk to admit that they need a more efficient way for traffic to pass through the intersection.

Your job is to design and implement a solution using the synchronization primitives (locks) that you have developed in the previous part.

Modeling the intersection

Before you begin coding, answer the follow questions in exercises.txt:

1. Assume that the residents of Podunk are exceptional and follow the old (and widely ignored) convention that whoever arrives at the intersection first proceeds first. Using the language of synchronization primitives describe the way this intersection is controlled. In what ways is this method suboptimal?

2. Now, assume that the residents of Podunk are like most people and do not follow the convention described above. In what one instance can this four-way-stop intersection produce a deadlock? (It will be helpful to think of this in terms of the model we are using instead of trying to visualize an actual intersection).

Attachment:- Programming Assignment.rar

Reference no: EM132376264

Questions Cloud

What is annualized holding period return : You sold all stocks today for $83.72. During this period the stock paid dividends of $4.07 per share. What is your annualized holding period return
Discuss any potential negative uses of that technology : Besides biotechnology, identify one technology that seems to have the greatest potential positive effect on food security. Discuss any potential negative uses.
What is sarah holding period return : She sold all stocks today for $64.59. During the year the stock paid dividends of $3.56 per share. What is Sarah's holding period return.
News article that reports on any marine biology : Biology 118 -Your assignment is to find an online news article that reports on any marine biology topic you find interesting.
How does that function pick the next thread : CS 471 Operating Systems-Old Dominion University-USA-What function is responsible for choosing the next thread to run?
Why service companies are more sensitive : Examine the main reasons why service companies are more sensitive to labor and price variances, as compared to material price variances, and determine.
What is the present value of your? inheritance : You will receive a ?$80,000 inheritance in 8 years. You could invest that money today at 9?% compounded semi-annually
What is john annualized holding period return : During this period the stock paid dividends of $4.15 per share. What is John's annualized holding period return (annual percentage rate)?
Significance to society-health and culture of modern life : Present at least three of the discoveries you find to be most important and describe their significance to society, health, and the culture of modern life.

Reviews

Write a Review

Operating System Questions & Answers

  Implementation of algorithms for process management

The Shortest Job Next (SJN) algorithm queues processes in a way that the ones that use the shortest CPU cycle will be selected for running rst.

  Develop a user mode command interpreter

Develop a user mode command interpreter which support list-short.

  Memory allocation in operating system

Analysis and implementation of algorithms for memory allocation in operating system, Explain First- t and best- t methods are used in memory allocation in operating systems.

  Stand alone child process

Forking the child process

  Write a multi-threaded program

Write a multi-threaded program to solve producer and consumer problem

  Marginal and average cost curves

n a competitive market place (pure competition) is it possible to continually sell your product at a price above the average cost of production.

  Simulating operating systems scheduling

Simulate the long-term scheduler, the short-term scheduler and the I/O scheduler of the computer using the First-Come-First-Serve algorithm.

  Issues with trusted platform module

Research paper discussing the issues with Trusted Platform Module (TPM)

  Threads

Explain a complication that concurrent processing adds to an operating system.

  Design and programming

Use the semaphore methods to control the concurrency of the solution

  Virtual machines

Virtual machines supported by a host operating system

  Discuss an application that benefits barrier synchronization

Discuss an application that would benefit from the use of barrier synchronization

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd