1 / 16

Nachos Walk-through -- Threads

Nachos Walk-through -- Threads. Pengyu Zhang 2/1/2012. Logistics. Assignment 1 timeline: Milestone: Question 1 & 2. 2 /4 – Documentation due. 2 /7 – Code due . Milestone: Question 3 & 4. 2 /11 – Documentation due. 2 /14 – Code due . Deadline: All five questions

ping
Download Presentation

Nachos Walk-through -- Threads

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Nachos Walk-through-- Threads Pengyu Zhang 2/1/2012

  2. Logistics • Assignment 1 timeline: • Milestone: Question 1 & 2. • 2/4 – Documentation due. • 2/7 – Code due. • Milestone: Question 3 & 4. • 2/11 – Documentation due. • 2/14 – Code due. • Deadline: All five questions • 2/18 – Documentation due. • 2/21 – Code due. • What to turn in • Documentation • Source code • Tar your threads/ directory.

  3. Logistics • TA office hours: • Time: • Location: • Office hour this week • Bring your laptops • Showus • You have Nachos installed and running • You understand threading system of Nachos • How you split the workload. • You have started your project.

  4. Nachos threads • Lifetime of Nachos threading system • Booting up; • Create new threads; • Running threads; • Finishing all threads and halt.

  5. Creating the first thread • Question: How many threads are created when Nachos is booted? What are they?

  6. Create the ready queue Allocate CPU to the new KThread Set currentThread to the new Kthread Set TCB object Change the status to statusRunning. Create an idle thread.

  7. Make another new KThread, with the target set to an infinite yield() loop. Fork the idle thread off from the main thread.

  8. Creating new threads KThreadnewThread = new KThread(myRunnable); ... newThread.fork();

  9. Creating new threads • Question: why is there a call to ready() method in the fork() method?

  10. Running threads • Question: why is the sleep() method static, while the ready() method isn’t?

  11. Running threads

  12. Running threads • Question: At which place in KThread.java is the CPU scheduler called to decide which KThread should be given to CPU?

  13. Running threads

  14. Finishing a thread • Question: when does Nachos Kernel get rid of resources allocated for a thread that is completed? (using OS language, such as “when a new thread is forked”)

More Related