lecture5 - CSCC69H Lecture 5 Dan Zingaro June 7, 2010...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CSCC69H Lecture 5 Dan Zingaro June 7, 2010 Feedback from Reading Quiz I Lots of questions on the Linux proportional-share scheduler well talk about this! I ...why cant we just use importance for control as opposed to resource allocation? I If we say that thread x is more important than thread y , what would this mean? I Does x get all of the CPU until it finishes? Does it get half? Does it just get more than y ? Review: Processes and Threads I Process: group related resources together I Resources include open files, memory, devices, etc. I Thread: active entities scheduled on the CPU I Threads allow concurrency within a process, much like processes allow concurrency within a computer system I Within a process, each thread shares the same address space Context-Switching I Remember: whenever we switch the CPU to a different thread, a context-switch takes place I We save the context of the outgoing thread so that it can resume later, and load the context for the incoming thread I Switching among threads in the same process is much cheaper than switching to an entire new process I Thread switches do not require an address space change, changing memory mapping information, etc. Typical Context-switch Code In Os/161, find something similar in kern/mips/mips/switch.s push each register on the outgoing process stack store the stack pointer into outgoing->SP load the stack pointer from next->SP store label Ls address into outgoing->IP load in next->IP and jump to that address L: pop each register from the resumed outgoing stack Implementing Threads in User Space There are Two main ways to implement a threads package 1. User Space I Kernel knows nothing about the existence of threads I The runtime system maintains information about threads just as the OS maintains information about processes, and provides thread manipulation functions I Switching threads involves just storing the old threads registers and loading the new threads registers (much faster than trapping to the kernel) I Each process can have its own customized scheduling algorithm Implementing Threads in User Space... Disadvantages of user-space threads: I If one thread in a process makes a blocking system call, all threads in the process will be blocked I If one thread causes a page fault, the entire process is blocked by the OS I No other thread in a process will start running until one thread gives up the CPU (the OS will not switch among threads of a process) I A process with multiple threads has multiple stacks unknown to the kernel (kernel cannot grow stack when required) Implementing Threads in Kernel 2. Kernel I No run-time system and no thread table in each process I The kernel now has the thread table I Threads are created and destroyed by making system calls (slower) I When a thread blocks, the kernel can run another thread from the same process, or a thread from a different process (contrast with user threads) I There are also hybrid implementations that multiplex user-level threads on top of kernel-level threads What is Processor Scheduling?What is Processor Scheduling?...
View Full Document

This note was uploaded on 02/05/2011 for the course CS 69 taught by Professor Cathy during the Summer '10 term at University of Toronto- Toronto.

Page1 / 33

lecture5 - CSCC69H Lecture 5 Dan Zingaro June 7, 2010...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online