What we will learn. Threaded Systems: Threads. Threads. Threads. Bag of functions & procedures ST OS. AUCs. Threads. AUCs. Processes MT OS MP OS

Size: px
Start display at page:

Download "What we will learn. Threaded Systems: Threads. Threads. Threads. Bag of functions & procedures ST OS. AUCs. Threads. AUCs. Processes MT OS MP OS"

Transcription

1 What we will learn Threaded Systems: Threads A thread-driven approach is attractive in sensor networks for many of the same reasons that it has been adopted for PDAs, laptops, and servers. In a thread-driven system, an application programmer need not be concerned about indefinitely blocking or being indefinitely blocked by other tasks during execution, except for shared resources, because the scheduler will preemptively time-slice between threads, allowing some tasks to continue execution even though others may be blocked. This automated time-slicing considerably simplifies programming for an application developer. ST OS MT OS MP OS Threads Bag of functions & procedures Coroutines weak AUCs Threads Processes AUCs AUCs Threads Each abstract machine is called a thread: they all operate in the same (hardware) address space. The Thread approach depends on the existence of an interval timer that periodically raises an interrupt: When a timer interrupt occurs, the currently executing abstract machine is suspended and the OS begins to execute OS can invoke the scheduler to dispatch an abstract machine according to its scheduling policy. newly dispatched AUC executes until it voluntarily yields the CPU or another interval timer interrupt occurs

2 Clock interrupts Real-time clock: hardware device that pulses regularly an integral number of times each second, and interrupts the CPU each time a pulse occurs. Example: clock interrupts Real-time clock: hardware device that pulses regularly an integral number of times each second, and interrupts the CPU each time a pulse occurs. Different from the time-of-day clock that keeps the current time. A time-of-day clock also emits pulses at regular intervals unlike the real time clock, it does not interrupt the CPU after each pulse. Instead, it increments a counter, which the CPU may read to determine the current time Example: clock interrupts The number of times a clock pulses in a second is called clock rate. Typical clock rates are 10Hz, 60Hz, 100Hz, and 1000Hz. It is important that clock interrupts be serviced promptly to ensure that they are not lost. The hardware helps by giving a clock the highest priority among the various devices that can interrupt. The software helps by keeping making clock interrupt processing efficient by reducing the number of procedure calls made. Example: clock interrupts It is important that the processor not spend all its time processing clock interrupts. Solution: adjust the clock rate to match the system. A slower clock can be simulated by the clock interrupt handler: divide the clock rate by ignoring a certain number of interrupts before it processes one. This slower simulated rate is called the tick rate: the smallest size of the granularity of preemption and timed delays.

3 Network Stack Command Server Example: clock interrupts 20 ns (period) = 200 MHz (frequency) Example: clock handler in FreeRTOS /* * Handler for the timer interrupt. void vtickisr( void *pvbaseaddress ) unsigned portlong ulcsr;! /* Increment the RTOS tick - this might cause a task to unblock.! vtaskincrementtick();! /* Clear the timer interrupt!... Each period, counter is decremented when count =0 clock interrupt Int(t+1) - Int(t) = 1 clock tick! /* If we are using the preemptive scheduler then we also need to determine! if this tick should cause a context switch.! #if configuse_preemption == 1!! vtaskswitchcontext();! #endif Real stuff: Multithreaded MANTIS OS (MOS) MANTIS System API Kernel/Scheduler Hardware T3 T4 Device Drivers T5 User-level threads MANTIS OS Real stuff: Multithreaded MANTIS OS (MOS) When a thread is created, stack space is allocated by the kernel Dynamic thread stack allocated on heap Thread context saved on thread stack The space is recovered when the thread exits. MOS kernel: services provided are a subset of POSIX threads Preemptive multi- threading: priority-based thread scheduling round-robin semantics within a priority level. Fast context switching (~60microsecs) 144 byte footprint for scheduler Static thread table (default 12 threads) 10 bytes per thread entry

4 Real stuff: Multithreaded MANTIS OS (MOS) Driver threads User threads Idle thread created by the kernel at startup. low priority runs when all other threads are blocked. implement power-aware scheduling, as it may detect patterns in CPU utilization and adjust kernel parameters to conserve energy. Real stuff: Multithreaded MANTIS OS (MOS) The scheduler receives a timer interrupt from the hardware to trigger context switches; switches may also be triggered by system calls or semaphore operations. The timer interrupt is the only one handled by the kernel: other hardware interrupts are sent directly to the associated device drivers. Upon an interrupt, a device driver typically posts a semaphore in order to activate a waiting thread,and this thread handles whatever event caused the interrupt. No soft interrupts supported by the MOS kernel MOS Thread Table data structure The kernel s main global data structure is a thread table, with one entry per thread. Allocated statically: there is a fixed maximum number of threads and a fixed level of memory overhead. The maximum thread count is adjustable at compile time (the default is 12). Each thread table contains a current stack pointer, stack boundary information (base pointer and size), a pointer to the thread s starting function, the thread s priority level, and a next thread pointer for use in linked lists. MOS Thread Table data structure Thread structure definition typedef struct thread_s Stack pointer stackval_t *sp; Pointer to stack memory for de-allocating stackval_t *stack; Size of stack (for debugging) uint16_t stacksize; Function pointer to thread's start func void (*func)(void); Thread sleep time uint32_t st; Current thread state uint8_t state; Current thread suspend state uint8_t suspend_state; Thread priority uint8_t priority; Port number -- Only used for net recv uint8_t port; Next thread on list struct thread_s *next; struct thread_s *waiting_for; uint8_t thread_id; mos_thread_t;

5 MOS Thread Table data structure The kernel s main global data structure is a thread table, with one entry per thread. Allocated statically: there is a fixed maximum number of threads and a fixed level of memory overhead. The maximum thread count is adjustable at compile time (the default is 12). Each thread table contains a current stack pointer, stack boundary information (base pointer and size), a pointer to the thread s starting function, the thread s priority level, and a next thread pointer for use in linked lists. // init the thread table for(i = 0; i < MAX_THREADS; i++) threads[i].sp = 0; threads[i].state = EMPTY; threads[i].suspend_state = SUSPEND_STATE_SLEEP; threads[i].priority = 0; threads[i].next = NULL; threads[i].waiting_for = NULL; MOS: Creating a new thread... //Search for a free slot in the thread table. for(id = 0; id < MAX_THREADS; id++) if(threads[id].state == EMPTY) break;... //Allocate memory for the stack space. stack_addr = (stackval_t *)mos_mem_alloc(stack_size); if(stack_addr == NULL) mos_enable_ints(int_handle); return NO_MORE_MEMORY; // Can't continue if we don't have memory // Now save the beginning of the stack to the thread's stack variable threads[id].stack = stack_addr; threads[id].stacksize = stack_size; threads[id].func = function_start; threads[id].state = READY; // Init thread state threads[id].suspend_state = SUSPEND_STATE_IDLE; threads[id].priority = priority; threads[id].thread_id = id; Simple Thread state diagram Better Thread state diagram Schedule READY Sleeping Queue Schedule thread_suspend READY Blocked Queue BLOCKED

6 Thread state in Mantis OS enum Thread is empty. EMPTY = 0, Thread is running., Thread will run at next opportunity. READY, Thread is blocked. BLOCKED, Thread is sleeping. ; Suspend states enum Thread is not waiting on interrupts, ok to sleep SUSPEND_STATE_IDLE = 0, Thread needs an interrupt, do not sleep SUSPEND_STATE_SLEEP, Total number of suspend states SUSPEND_STATE_MAX ; Some thread functions in Mantis /mos/kernel/<platform>/include/msched.h Create a new thread and put it on the ready queue. * Note: There is no memory protection so watch your stack sizes. function_start Pointer to function to call on thread start stack_size Stack space to give the thread. If the specified * stack size is smaller than MIN_STACK_SIZE, MIN_STACK_SIZE will be used instead. priority Priority of the thread THREAD_OK, NO_MORE_THREADS, NO_MORE_MEMORY, BAD_THREAD_PRIORITY uint8_t mos_ (void (*function_start)(void), memtype_t stack_size,uint8_t priority); Resume a blocked thread thread Thread to resume void mos_(mos_thread_t *thread); Suspend to a specific state state the state to suspend to void mos_thread_suspend_(uint8_t state); Put the currently running thread to sleep. * Units are in ms * Minimum sleeptime is 128 ms (will be promoted) void mos_(uint32_t sleeptime); Terminate the calling thread. void mos_ (void); Summing up: How Multi-threaded systems work The computer is initialized: OS is loaded and initialized; this creates a software environment composed of multiple abstract machines, The OS accepts requests to execute an application program, assigns each request to an abstract machine, and then systematically allocates physical machine components to the abstract machines. When an AUC has been allocated the appropriate resources, it executes; otherwise it is blocked. Each AUC is a thread, since it operate in the same (hardware) address space. The TP approach depends on the existence of an interval timer that periodically raises an interrupt. When a timer interrupt occurs, the currently executing abstract machine is suspended and the OS begins to execute. In particular, it can invoke the scheduler to dispatch an abstract machine according to its scheduling policy. The newly dispatched abstract machine executes until it voluntarily yields the CPU or another interval timer interrupt occurs. /mos/sys int main(void) sched_init(); //init scheduler--this MUST BE FIRST Starting the OS = starting the scheduler com_init(); //init com system... mos_(pre_start, START_STACK_SIZE, PRIORITY_NORMAL); //start the scheduler (never returns) mos_sched_start(); return 0;

7 Application's start function. extern void start(void); prestart() is the function for the startup thread, the one spawned by main(). * It does all the initialization that needs to happen after the * kernel is up and running, and then it calls the application start function. void pre_start(void) #ifdef PLATFORM_LINUX mos_node_id_init();! // must be called before gevent_init () gevent_init(); serial_init(); terminal_init(); xmos_radio_init();! // gevent_init() must be called first xmos_flash_init();! // gevent_init() must be called first mos_thread_suspend(); //fixes threading issue with freebsd #elif defined(arch_micro) uart_init(); printf_init(); plat_init(); clock_init(); #if defined(platform_telosb) kernel_timer_init(); #endif mos_node_id_init(); #endif //if defined(arch_avr) #ifdef MOS_DEBUG mos_debug_post_init(); #endif start(); // STARTS THE APPLICATION Scheduling threads Schedule READY Starting the scheduler void mos_sched_start(void) running = TRUE; //initialize the hardware timers which control //sleeping and timeslicing kernel_timer_init(); sleep_timer_init(); From Other States Ready Thread Scheduling threads Thread Descriptor // Once interrupts are enabled here, the sheduler will start to schedule // threads and do time slicing. ENABLE_INTS(); //Start executing the first thread dispatcher(); Enqueuer // On to the idle loop idle_loop(); Dispatcher Context Switcher CPU Running Thread

8 From Other States Ready Thread Enqueuer Scheduling threads Ready queue Thread Descriptor Scheduling threads : Thread context R1 R2... Rn Right Operand Left Operand Result Functional Unit Status Registers ALU Dispatcher Context Switcher CPU Running Thread PC IR CPU Context switching Old Thread Descriptor New Thread Descriptor Context switching in Mantis Scheduler context switches only when it receives timer interrupt from the hardware. No Soft Interrupts /** Save current stack pointer * Change stack pointer to process stack * Push address of start_thread function onto stack * Push zeroes for initial register vals and sreg * Save adjusted stack ptr to thread struct * Restore kernel stack ptr #define PUSH_THREAD_STACK()... asm volatile(!! \! "push r31\n\t"!!! \! "push r30\n\t"!!! \! "push r29\n\t"!!! \! "push r28\n\t"!!! \!... /** Restore the stack pointer * Restore SREG * Restore the other registers #define POP_THREAD_STACK()\!... asm volatile(!!!! "pop r2\n\t"! \! "pop r3\n\t"! \! "pop r4\n\t"! \! "pop r5\n\t"! \!...

9 Invoking the Scheduler Voluntary Sharing Need a mechanism to call the scheduler Voluntary call Process blocks itself Calls the scheduler Involuntary call External force (interrupt) blocks the process Calls the scheduler Every process periodically yields to the scheduler Relies on correct process behavior Malicious Accidental Need a mechanism to override running process Involuntary CPU Sharing Interval timer Device to produce a periodic interrupt Programmable period IntervalTimer() InterruptCount--; if(interruptcount <= 0) Interrupt = TRUE; InterruptCount = K; SetInterval(programmableValue) K = programmablevalue: InterruptCount = K; Involuntary CPU Sharing (cont) Interval timer device handler Keeps an in-memory clock up-to-date Invokes the scheduler IntervalTimerHandler() Time++; // update the clock TimeToSchedule--; if(timetoschedule <= 0) <invoke scheduler>; TimeToSchedule = TimeSlice;

10 Contemporary Scheduling Scheduling threads Involuntary CPU sharing timer interrupts Time quantum determined by interval timer usually fixed size for every process using the system Sometimes called the time slice length From Other States Ready Thread Enqueuer Ready List Thread Descriptor Dispatcher Context Switcher CPU Running Thread Mantis OS scheduling: dispatcher Running to Ready void attribute ((naked)) dispatcher(void) #endif // Prologue: Saves the current state. // All registers go onto current stack and then the stack is saved dispatcher_int_handle = mos_disable_ints(); running = FALSE; elapsed_thread_time = 0; PUSH_THREAD_STACK();... // Only change the thread's state if it was running, not blocked if(_current_thread->state == ) _current_thread->state = READY; mos_tlist_add(&readyq[_current_thread->priority], _current_thread); // Now bring up the new thread // idle thread's existence guarantees we'll get something Disable interrupts begin Context switch Ready to Running // Now bring up the new thread // idle thread's existence guarantees we'll get something for(d_index = 0; d_index < NUM_PRIORITIES; d_index++) _current_thread = mos_tlist_remove(&readyq[d_index]); if(_current_thread!= NULL) break; _current_thread->state = ; POP_THREAD_STACK(); running = TRUE; // return must be explicit because naked functions don't have one #ifdef PLATFORM_IMOTE2 asm volatile("ldmfd r13!,pc"); #elif PLATFORM_MICROBLAZE #else asm volatile("ret\n"); #endif Mantis OS dispatcher mos_enable_ints(dispatcher_int_handle); End Context switch Enable interrupts

11 Mantis OS scheduling Real stuff: Mantis OS In the current implementation, the user is not encouraged to dynamically allocate heap space, although that was an API decision and is not an inherent limitation of MOS. This limitation is imposed because with such limited memory it is importantto have a well planned and coherent memory management policy. A thread s current context, including saved register values, is stored on its stack when the thread is suspended. This is significant, because the context is much larger than a thread table entry, and it only needs to be stored when the thread is allocated. The kernel also maintains ready-list head and tail pointers for each priority level (5 by default, for 20 bytes total). Keeping both pointers allows for fast addition and deletion, which improves performance when manipulating thread lists. This is important because those manipulations are frequent and always occur with interrupts disabled. There is also a current thread pointer (2 bytes), an interrupt status byte, and one byte of flags. The total static overhead for the scheduler is thus 144 bytes. Putting a thread to sleep Putting a thread to sleep Dispatch thread_suspend READY void mos_(uint32_t sleeptime) handle_t int_handle; int_handle = mos_disable_ints(); _current_thread->state = ; // Update the thread state _current_thread->st = sleeptime + elapsed_thread_time; // Update the sleeptime mos_tlist_ordadd(&sleepq, _current_thread); mos_thread_wakeup(elapsed_thread_time, int_handle); BLOCKED

12 Suspending a thread Suspending a thread Dispatch thread_suspend READY void mos_thread_suspend_state(uint8_t state) if(state >= SUSPEND_STATE_MAX) state = SUSPEND_STATE_IDLE; handle_t int_handle = mos_disable_ints(); _current_thread->next = NULL; _current_thread->state = BLOCKED; // Update the thread state // store the old suspend state in the sleep time, // which we aren't using _current_thread->st = (uint32_t)_current_thread->suspend_state; _current_thread->suspend_state = state; mos_thread_wakeup(elapsed_thread_time, int_handle); BLOCKED Resuming a thread Resuming a thread Dispatch thread_suspend READY void mos_(mos_thread_t *thread) handle_t int_handle; int_handle = mos_disable_ints(); // put given thread onto the ready Queue if it was blocked. if(thread->state == BLOCKED) mos_tlist_add(&readyq[thread->priority], thread); thread->state = READY; thread->suspend_state = (uint8_t)thread->st; mos_thread_wakeup(elapsed_thread_time, int_handle); BLOCKED

13 void mos_thread_wakeup(uint16_t sleep_time) //Adjust the sleepq with the times that has already expired. mos_tlist_adjustst(&sleepq, sleep_time); //get the first thread in the sleep queue wakeup_front = mos_tlist_head(&sleepq); //loop through the sleep queue while((wakeup_front!= NULL) && (wakeup_front->st == 0)) Waking up a thread //remove the thread if sleep time is 0 sleep_thread = mos_tlist_remove(&sleepq); sleep_thread->state = READY; // Update the thread state //add thread to ready queue mos_tlist_add(&readyq[sleep_thread->priority], sleep_thread); wakeup_front = mos_tlist_head(&sleepq); dispatcher(); // do the context switch. Dispatching a thread dispatch thread_suspend READY BLOCKED Summary OS does not depend on the CPU mode bit: can support the thread model, but any process can read/write the address space of any other thread and are able to change any CPU register and access all information stored in executable memory. Depend on interrupts, in particular on a timer device that periodically interrupts the CPU and gives control to the OS. Supports schedulable units of computation: threads Threads are AUC but there are few barriers among the the AUCs. Individual programs need not incorporate design dependencies as required in a DS system (coroutine programming)

Threads and Concurrency

Threads and Concurrency Threads and Concurrency 1 Threads and Concurrency key concepts threads, concurrent execution, timesharing, context switch, interrupts, preemption reading Three Easy Pieces: Chapter 26 (Concurrency and

More information

Threads and Concurrency

Threads and Concurrency Threads and Concurrency 1 Threads and Concurrency key concepts threads, concurrent execution, timesharing, context switch, interrupts, preemption reading Three Easy Pieces: Chapter 26 (Concurrency and

More information

Corso di Elettronica dei Sistemi Programmabili

Corso di Elettronica dei Sistemi Programmabili Corso di Elettronica dei Sistemi Programmabili Sistemi Operativi Real Time freertos implementation Aprile 2014 Stefano Salvatori 1/24 Sommario RTOS tick Execution context Context switch example 2/24 RTOS

More information

FreeRTOS. A Brief Overview. Christopher Kenna. October 1, Avionics. FreeRTOS 1 / 34

FreeRTOS. A Brief Overview. Christopher Kenna. October 1, Avionics. FreeRTOS 1 / 34 A Brief Overview Christopher Kenna Avionics October 1, 2010 1 / 34 Introduction Outline 1 Introduction About Kernel Overview 2 Tasks Tasks versus Co-Routines Task Details 3 IPC and Synchronization Queues

More information

Context Switching & Task Scheduling

Context Switching & Task Scheduling ECE3411 Fall 2015 Lab 6b. Context Switching & Task Scheduling Marten van Dijk, Syed Kamran Haider Department of Electrical & Computer Engineering University of Connecticut Email: {vandijk, syed.haider}@engr.uconn.edu

More information

FreeRTOS. A Brief Overview. Christopher Kenna. October 1, Avionics. FreeRTOS 1 / 34

FreeRTOS. A Brief Overview. Christopher Kenna. October 1, Avionics. FreeRTOS 1 / 34 FreeRTOS A Brief Overview Christopher Kenna Avionics October 1, 2010 FreeRTOS 1 / 34 Background Information The FreeRTOS Project supports 25 official architecture ports, with many more community developed

More information

SMD149 - Operating Systems

SMD149 - Operating Systems SMD149 - Operating Systems Roland Parviainen November 3, 2005 1 / 45 Outline Overview 2 / 45 Process (tasks) are necessary for concurrency Instance of a program in execution Next invocation of the program

More information

Today s Topics. u Thread implementation. l Non-preemptive versus preemptive threads. l Kernel vs. user threads

Today s Topics. u Thread implementation. l Non-preemptive versus preemptive threads. l Kernel vs. user threads Today s Topics COS 318: Operating Systems Implementing Threads u Thread implementation l Non-preemptive versus preemptive threads l Kernel vs. user threads Jaswinder Pal Singh and a Fabulous Course Staff

More information

Review: Program Execution. Memory program code program data program stack containing procedure activation records

Review: Program Execution. Memory program code program data program stack containing procedure activation records Threads and Concurrency 1 Review: Program Execution Registers program counter, stack pointer,... Memory program code program data program stack containing procedure activation records CPU fetches and executes

More information

Review: Program Execution. Memory program code program data program stack containing procedure activation records

Review: Program Execution. Memory program code program data program stack containing procedure activation records Threads and Concurrency 1 Review: Program Execution Registers program counter, stack pointer,... Memory program code program data program stack containing procedure activation records CPU fetches and executes

More information

CS 318 Principles of Operating Systems

CS 318 Principles of Operating Systems CS 318 Principles of Operating Systems Fall 2017 Lecture 5: Thread Ryan Huang Administrivia HW1 solution released on Piazza resources Lab 0 grading - In progress - Cheating policy Lab 1 review session

More information

Review: Program Execution. Memory program code program data program stack containing procedure activiation records

Review: Program Execution. Memory program code program data program stack containing procedure activiation records Threads and Concurrency 1 Review: Program Execution Registers program counter, stack pointer,... Memory program code program data program stack containing procedure activiation records CPU fetches and

More information

CS 318 Principles of Operating Systems

CS 318 Principles of Operating Systems CS 318 Principles of Operating Systems Fall 2018 Lecture 5: Thread Ryan Huang Slides adapted from Geoff Voelker s and David Mazières lectures Administrivia Lab 0 grading in progress Lab 1 review session

More information

Embedded Systems. 5. Operating Systems. Lothar Thiele. Computer Engineering and Networks Laboratory

Embedded Systems. 5. Operating Systems. Lothar Thiele. Computer Engineering and Networks Laboratory Embedded Systems 5. Operating Systems Lothar Thiele Computer Engineering and Networks Laboratory Embedded Operating Systems 5 2 Embedded Operating System (OS) Why an operating system (OS) at all? Same

More information

Review: Program Execution. Memory program code program data program stack containing procedure activation records

Review: Program Execution. Memory program code program data program stack containing procedure activation records Threads and Concurrency 1 Review: Program Execution Registers program counter, stack pointer,... Memory program code program data program stack containing procedure activation records CPU fetches and executes

More information

AC OB S. Multi-threaded FW framework (OS) for embedded ARM systems Torsten Jaekel, June 2014

AC OB S. Multi-threaded FW framework (OS) for embedded ARM systems Torsten Jaekel, June 2014 AC OB S Multi-threaded FW framework (OS) for embedded ARM systems Torsten Jaekel, June 2014 ACOBS ACtive OBject (operating) System Simplified FW System for Multi-Threading on ARM embedded systems ACOBS

More information

Process Scheduling Queues

Process Scheduling Queues Process Control Process Scheduling Queues Job queue set of all processes in the system. Ready queue set of all processes residing in main memory, ready and waiting to execute. Device queues set of processes

More information

ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective. Part I: Operating system overview: Processes and threads

ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective. Part I: Operating system overview: Processes and threads ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective Part I: Operating system overview: Processes and threads 1 Overview Process concept Process scheduling Thread

More information

THE PROCESS ABSTRACTION. CS124 Operating Systems Winter , Lecture 7

THE PROCESS ABSTRACTION. CS124 Operating Systems Winter , Lecture 7 THE PROCESS ABSTRACTION CS124 Operating Systems Winter 2015-2016, Lecture 7 2 The Process Abstraction Most modern OSes include the notion of a process Term is short for a sequential process Frequently

More information

Scheduling. Scheduling 1/51

Scheduling. Scheduling 1/51 Scheduling 1/51 Learning Objectives Scheduling To understand the role of a scheduler in an operating system To understand the scheduling mechanism To understand scheduling strategies such as non-preemptive

More information

Processes. Dr. Yingwu Zhu

Processes. Dr. Yingwu Zhu Processes Dr. Yingwu Zhu Process Growing Memory Stack expands automatically Data area (heap) can grow via a system call that requests more memory - malloc() in c/c++ Entering the kernel (mode) Hardware

More information

Operating Systems Design Fall 2010 Exam 1 Review. Paul Krzyzanowski

Operating Systems Design Fall 2010 Exam 1 Review. Paul Krzyzanowski Operating Systems Design Fall 2010 Exam 1 Review Paul Krzyzanowski pxk@cs.rutgers.edu 1 Question 1 To a programmer, a system call looks just like a function call. Explain the difference in the underlying

More information

Lecture 4: Mechanism of process execution. Mythili Vutukuru IIT Bombay

Lecture 4: Mechanism of process execution. Mythili Vutukuru IIT Bombay Lecture 4: Mechanism of process execution Mythili Vutukuru IIT Bombay Low-level mechanisms How does the OS run a process? How does it handle a system call? How does it context switch from one process to

More information

Please do not handin a.doc file, a.zip file, a.tar file, or anything else

Please do not handin a.doc file, a.zip file, a.tar file, or anything else Please do not handin a.doc file, a.zip file, a.tar file, or anything else Hand in the files that are requested and only the files that are requested No executables! Lecture on Thurs is canceled Shuying

More information

Processes and Non-Preemptive Scheduling. Otto J. Anshus

Processes and Non-Preemptive Scheduling. Otto J. Anshus Processes and Non-Preemptive Scheduling Otto J. Anshus Threads Processes Processes Kernel An aside on concurrency Timing and sequence of events are key concurrency issues We will study classical OS concurrency

More information

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems Processes CS 475, Spring 2018 Concurrent & Distributed Systems Review: Abstractions 2 Review: Concurrency & Parallelism 4 different things: T1 T2 T3 T4 Concurrency: (1 processor) Time T1 T2 T3 T4 T1 T1

More information

Operating System Concepts Ch. 5: Scheduling

Operating System Concepts Ch. 5: Scheduling Operating System Concepts Ch. 5: Scheduling Silberschatz, Galvin & Gagne Scheduling In a multi-programmed system, multiple processes may be loaded into memory at the same time. We need a procedure, or

More information

Today s Topics. u Thread implementation. l Non-preemptive versus preemptive threads. l Kernel vs. user threads

Today s Topics. u Thread implementation. l Non-preemptive versus preemptive threads. l Kernel vs. user threads Today s Topics COS 318: Operating Systems Implementing Threads u Thread implementation l Non-preemptive versus preemptive threads l Kernel vs. user threads Jaswinder Pal Singh Computer Science Department

More information

ArdOS The Arduino Operating System Reference Guide Contents

ArdOS The Arduino Operating System Reference Guide Contents ArdOS The Arduino Operating System Reference Guide Contents 1. Introduction... 2 2. Error Handling... 2 3. Initialization and Startup... 2 3.1 Initializing and Starting ArdOS... 2 4. Task Creation... 3

More information

Processes. Overview. Processes. Process Creation. Process Creation fork() Processes. CPU scheduling. Pål Halvorsen 21/9-2005

Processes. Overview. Processes. Process Creation. Process Creation fork() Processes. CPU scheduling. Pål Halvorsen 21/9-2005 INF060: Introduction to Operating Systems and Data Communication Operating Systems: Processes & CPU Pål Halvorsen /9-005 Overview Processes primitives for creation and termination states context switches

More information

Review: Program Execution. Memory program code program data program stack containing procedure activation records

Review: Program Execution. Memory program code program data program stack containing procedure activation records Threads and Concurrency 1 Review: Program Execution Registers program counter, stack pointer,... Memory program code program data program stack containing procedure activation records CPU fetches and executes

More information

System Call. Preview. System Call. System Call. System Call 9/7/2018

System Call. Preview. System Call. System Call. System Call 9/7/2018 Preview Operating System Structure Monolithic Layered System Microkernel Virtual Machine Process Management Process Models Process Creation Process Termination Process State Process Implementation Operating

More information

Tasks. Task Implementation and management

Tasks. Task Implementation and management Tasks Task Implementation and management Tasks Vocab Absolute time - real world time Relative time - time referenced to some event Interval - any slice of time characterized by start & end times Duration

More information

Scheduling. Scheduling 1/51

Scheduling. Scheduling 1/51 Scheduling 1/51 Scheduler Scheduling Scheduler allocates cpu(s) to threads and processes. This action is known as scheduling. The scheduler is a part of the process manager code that handles scheduling.

More information

Introduction to the ThreadX Debugger Plugin for the IAR Embedded Workbench C-SPYDebugger

Introduction to the ThreadX Debugger Plugin for the IAR Embedded Workbench C-SPYDebugger C-SPY plugin Introduction to the ThreadX Debugger Plugin for the IAR Embedded Workbench C-SPYDebugger This document describes the IAR C-SPY Debugger plugin for the ThreadX RTOS. The ThreadX RTOS awareness

More information

Announcements. Program #1. Reading. Due 2/15 at 5:00 pm. Finish scheduling Process Synchronization: Chapter 6 (8 th Ed) or Chapter 7 (6 th Ed)

Announcements. Program #1. Reading. Due 2/15 at 5:00 pm. Finish scheduling Process Synchronization: Chapter 6 (8 th Ed) or Chapter 7 (6 th Ed) Announcements Program #1 Due 2/15 at 5:00 pm Reading Finish scheduling Process Synchronization: Chapter 6 (8 th Ed) or Chapter 7 (6 th Ed) 1 Scheduling criteria Per processor, or system oriented CPU utilization

More information

Processes Prof. James L. Frankel Harvard University. Version of 6:16 PM 10-Feb-2017 Copyright 2017, 2015 James L. Frankel. All rights reserved.

Processes Prof. James L. Frankel Harvard University. Version of 6:16 PM 10-Feb-2017 Copyright 2017, 2015 James L. Frankel. All rights reserved. Processes Prof. James L. Frankel Harvard University Version of 6:16 PM 10-Feb-2017 Copyright 2017, 2015 James L. Frankel. All rights reserved. Process Model Each process consists of a sequential program

More information

OPERATING SYSTEMS CS3502 Spring Processor Scheduling. Chapter 5

OPERATING SYSTEMS CS3502 Spring Processor Scheduling. Chapter 5 OPERATING SYSTEMS CS3502 Spring 2018 Processor Scheduling Chapter 5 Goals of Processor Scheduling Scheduling is the sharing of the CPU among the processes in the ready queue The critical activities are:

More information

Process- Concept &Process Scheduling OPERATING SYSTEMS

Process- Concept &Process Scheduling OPERATING SYSTEMS OPERATING SYSTEMS Prescribed Text Book Operating System Principles, Seventh Edition By Abraham Silberschatz, Peter Baer Galvin and Greg Gagne PROCESS MANAGEMENT Current day computer systems allow multiple

More information

CSE 153 Design of Operating Systems Fall 2018

CSE 153 Design of Operating Systems Fall 2018 CSE 153 Design of Operating Systems Fall 2018 Lecture 5: Threads/Synchronization Implementing threads l Kernel Level Threads l u u All thread operations are implemented in the kernel The OS schedules all

More information

PROCESS SCHEDULING II. CS124 Operating Systems Fall , Lecture 13

PROCESS SCHEDULING II. CS124 Operating Systems Fall , Lecture 13 PROCESS SCHEDULING II CS124 Operating Systems Fall 2017-2018, Lecture 13 2 Real-Time Systems Increasingly common to have systems with real-time scheduling requirements Real-time systems are driven by specific

More information

OPERATING SYSTEM PROJECT: SOS

OPERATING SYSTEM PROJECT: SOS OPERATING SYSTEM PROJECT: SOS I. Description 1. This project simulates a noninteractive (batch) monolithic operating system. Your program, OS, is a set of functions invoked by SOS (Student Operating System),

More information

Asynchronous Events on Linux

Asynchronous Events on Linux Asynchronous Events on Linux Frederic.Rossi@Ericsson.CA Open System Lab Systems Research June 25, 2002 Ericsson Research Canada Introduction Linux performs well as a general purpose OS but doesn t satisfy

More information

CODE TIME TECHNOLOGIES. Abassi RTOS. Porting Document C28X CCS

CODE TIME TECHNOLOGIES. Abassi RTOS. Porting Document C28X CCS CODE TIME TECHNOLOGIES Abassi RTOS Porting Document C28X CCS Copyright Information This document is copyright Code Time Technologies Inc. 2012-2013. All rights reserved. No part of this document may be

More information

Implementation of Processes

Implementation of Processes Implementation of Processes A processes information is stored in a process control block (PCB) The PCBs form a process table Sometimes the kernel stack for each process is in the PCB Sometimes some process

More information

SE350: Operating Systems. Lecture 3: Concurrency

SE350: Operating Systems. Lecture 3: Concurrency SE350: Operating Systems Lecture 3: Concurrency Main Points Thread abstraction What are threads and what is the thread abstraction? Thread life cycle What states does a thread go through? Thread Implementation

More information

UNIT -3 PROCESS AND OPERATING SYSTEMS 2marks 1. Define Process? Process is a computational unit that processes on a CPU under the control of a scheduling kernel of an OS. It has a process structure, called

More information

Scheduling Mar. 19, 2018

Scheduling Mar. 19, 2018 15-410...Everything old is new again... Scheduling Mar. 19, 2018 Dave Eckhardt Brian Railing Roger Dannenberg 1 Outline Chapter 5 (or Chapter 7): Scheduling Scheduling-people/textbook terminology note

More information

Roadmap for This Lecture

Roadmap for This Lecture Thread Scheduling 1 Roadmap for This Lecture Overview Priorities Scheduling States Scheduling Data Structures Quantum Scheduling Scenarios Priority Adjustments (boosts and decays) Multiprocessor Scheduling

More information

COMP 7860 Embedded Real- Time Systems: Threads

COMP 7860 Embedded Real- Time Systems: Threads COMP 7860 Embedded Real- Time Systems: Threads Jacky Baltes Autonomous Agents Lab University of Manitoba Winnipeg, Canada R3T 2N2 Email: jacky@cs.umanitoba.ca WWW: http://www.cs.umanitoba.ca/~jacky http://aalab.cs.umanitoba.ca

More information

CSCI 8530 Advanced Operating Systems. Part 10 Clock and Timer Management

CSCI 8530 Advanced Operating Systems. Part 10 Clock and Timer Management CSCI 8530 Advanced Operating Systems Part 10 Clock and Timer Management Updated 10/11/2016 Location of Clock Management in the Hierarchy Clock Hardware Processor clock Controls processor rate Often cited

More information

Learning Outcomes. Processes and Threads Implementation. Processes Process s user-level stack and execution state. Threads The Thread Model.

Learning Outcomes. Processes and Threads Implementation. Processes Process s user-level stack and execution state. Threads The Thread Model. Processes and Threads Implementation Learning Outcomes An understanding of the typical implementation strategies of processes and threads Including an appreciation of the trade-offs between the implementation

More information

Processes and Threads Implementation

Processes and Threads Implementation Processes and Threads Implementation 1 Learning Outcomes An understanding of the typical implementation strategies of processes and threads Including an appreciation of the trade-offs between the implementation

More information

Processes and Threads Implementation

Processes and Threads Implementation Processes and Threads Implementation 1 Learning Outcomes An understanding of the typical implementation strategies of processes and threads Including an appreciation of the trade-offs between the implementation

More information

Interrupts and Time. Real-Time Systems, Lecture 5. Martina Maggio 28 January Lund University, Department of Automatic Control

Interrupts and Time. Real-Time Systems, Lecture 5. Martina Maggio 28 January Lund University, Department of Automatic Control Interrupts and Time Real-Time Systems, Lecture 5 Martina Maggio 28 January 2016 Lund University, Department of Automatic Control Content [Real-Time Control System: Chapter 5] 1. Interrupts 2. Clock Interrupts

More information

Concurrent Programming. Implementation Alternatives. Content. Real-Time Systems, Lecture 2. Historical Implementation Alternatives.

Concurrent Programming. Implementation Alternatives. Content. Real-Time Systems, Lecture 2. Historical Implementation Alternatives. Content Concurrent Programming Real-Time Systems, Lecture 2 [Real-Time Control System: Chapter 3] 1. Implementation Alternatives Martina Maggio 19 January 2017 Lund University, Department of Automatic

More information

Concurrent Programming

Concurrent Programming Concurrent Programming Real-Time Systems, Lecture 2 Martina Maggio 19 January 2017 Lund University, Department of Automatic Control www.control.lth.se/course/frtn01 Content [Real-Time Control System: Chapter

More information

Lesson FreeRTOS + LPC17xx. FreeRTOS & Tasks LPC17xx Memory Map Lab Assignment: FreeRTOS Tasks

Lesson FreeRTOS + LPC17xx. FreeRTOS & Tasks LPC17xx Memory Map Lab Assignment: FreeRTOS Tasks Lesson FreeRTOS + LPC17xx FreeRTOS & Tasks LPC17xx Memory Map Lab Assignment: FreeRTOS Tasks FreeRTOS & Tasks Introduction to FreeRTOS Objective To introduce what, why, when, and how to use Real Time Operating

More information

Section 7: Scheduling and Fairness

Section 7: Scheduling and Fairness March 1-2, 2018 Contents 1 Warmup 2 2 Vocabulary 2 3 Problems 3 3.1 Scheduling............................................. 3 3.2 Simple Priority Scheduler.................................... 4 3.2.1 Fairness..........................................

More information

Lecture 5: Concurrency and Threads

Lecture 5: Concurrency and Threads CS 422/522 Design & Implementation of Operating Systems Lecture 5: Concurrency and Threads Zhong Shao Dept of Computer Science Yale University Acknowledgement: some slides are taken from previous versions

More information

Interrupts and Time. Interrupts. Content. Real-Time Systems, Lecture 5. External Communication. Interrupts. Interrupts

Interrupts and Time. Interrupts. Content. Real-Time Systems, Lecture 5. External Communication. Interrupts. Interrupts Content Interrupts and Time Real-Time Systems, Lecture 5 [Real-Time Control System: Chapter 5] 1. Interrupts 2. Clock Interrupts Martina Maggio 25 January 2017 Lund University, Department of Automatic

More information

Threads Chapter 5 1 Chapter 5

Threads Chapter 5 1 Chapter 5 Threads Chapter 5 1 Chapter 5 Process Characteristics Concept of Process has two facets. A Process is: A Unit of resource ownership: a virtual address space for the process image control of some resources

More information

AN HONORS UNIVERSITY IN MARYLAND UMBC. AvrX. Yousef Ebrahimi Professor Ryan Robucci

AN HONORS UNIVERSITY IN MARYLAND UMBC. AvrX.   Yousef Ebrahimi Professor Ryan Robucci AvrX https://github.com/kororos/avrx Yousef Ebrahimi Professor Ryan Robucci Introduction AvrX is a Real Time Multitasking Kernel written for the Atmel AVR series of micro controllers. The Kernel is written

More information

Outline. Process and Thread Management. Data Structures (2) Data Structures. Kernel Process Block (PCB)

Outline. Process and Thread Management. Data Structures (2) Data Structures. Kernel Process Block (PCB) Outline Process and Thread Management Ausgewählte Betriebssysteme Professur Betriebssysteme Fakultät Informatik Data Structures Process Creation Thread Creation Scheduling 2 Data Structures Data Structures

More information

Process and Thread Management

Process and Thread Management Process and Thread Management Ausgewählte Betriebssysteme Professur Betriebssysteme Fakultät Informatik Data Structures Process Creation Thread Creation Scheduling Outline 2 1 Data Structures Process represented

More information

PROCESS MANAGEMENT. Operating Systems 2015 Spring by Euiseong Seo

PROCESS MANAGEMENT. Operating Systems 2015 Spring by Euiseong Seo PROCESS MANAGEMENT Operating Systems 2015 Spring by Euiseong Seo Today s Topics Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication

More information

CIS233J Java Programming II. Threads

CIS233J Java Programming II. Threads CIS233J Java Programming II Threads Introduction The purpose of this document is to introduce the basic concepts about threads (also know as concurrency.) Definition of a Thread A thread is a single sequential

More information

Project No. 2: Process Scheduling in Linux Submission due: April 12, 2013, 11:59pm

Project No. 2: Process Scheduling in Linux Submission due: April 12, 2013, 11:59pm Project No. 2: Process Scheduling in Linux Submission due: April 12, 2013, 11:59pm PURPOSE Getting familiar with the Linux kernel source code. Understanding process scheduling and how different parameters

More information

Native POSIX Thread Library (NPTL) CSE 506 Don Porter

Native POSIX Thread Library (NPTL) CSE 506 Don Porter Native POSIX Thread Library (NPTL) CSE 506 Don Porter Logical Diagram Binary Memory Threads Formats Allocators Today s Lecture Scheduling System Calls threads RCU File System Networking Sync User Kernel

More information

Bluetooth low energy Protocol Stack

Bluetooth low energy Protocol Stack APPLICATION NOTE R01AN2768EJ0130 Rev.1.30 Introduction This manual describes how to develop an application using the Bluetooth low energy software (hereafter called BLE software), and overview of RWKE

More information

Definition Multithreading Models Threading Issues Pthreads (Unix)

Definition Multithreading Models Threading Issues Pthreads (Unix) Chapter 4: Threads Definition Multithreading Models Threading Issues Pthreads (Unix) Solaris 2 Threads Windows 2000 Threads Linux Threads Java Threads 1 Thread A Unix process (heavy-weight process HWP)

More information

Operating System. Chapter 4. Threads. Lynn Choi School of Electrical Engineering

Operating System. Chapter 4. Threads. Lynn Choi School of Electrical Engineering Operating System Chapter 4. Threads Lynn Choi School of Electrical Engineering Process Characteristics Resource ownership Includes a virtual address space (process image) Ownership of resources including

More information

Homework. Reading. Machine Projects. Labs. Intel 8254 Programmable Interval Timer (PIT) Data Sheet. Continue on MP3

Homework. Reading. Machine Projects. Labs. Intel 8254 Programmable Interval Timer (PIT) Data Sheet. Continue on MP3 Homework Reading Intel 8254 Programmable Interval Timer (PIT) Data Sheet Machine Projects Continue on MP3 Labs Continue in labs with your assigned section 1 Restrictions on ISR Code Software that was executing

More information

CSE 306/506 Operating Systems Threads. YoungMin Kwon

CSE 306/506 Operating Systems Threads. YoungMin Kwon CSE 306/506 Operating Systems Threads YoungMin Kwon Processes and Threads Two characteristics of a process Resource ownership Virtual address space (program, data, stack, PCB ) Main memory, I/O devices,

More information

CS 322 Operating Systems Practice Midterm Questions

CS 322 Operating Systems Practice Midterm Questions ! CS 322 Operating Systems 1. Processes go through the following states in their lifetime. time slice ends Consider the following events and answer the questions that follow. Assume there are 5 processes,

More information

real-time kernel documentation

real-time kernel documentation version 1.1 real-time kernel documentation Introduction This document explains the inner workings of the Helium real-time kernel. It is not meant to be a user s guide. Instead, this document explains overall

More information

PROCESS CONTROL BLOCK TWO-STATE MODEL (CONT D)

PROCESS CONTROL BLOCK TWO-STATE MODEL (CONT D) MANAGEMENT OF APPLICATION EXECUTION PROCESS CONTROL BLOCK Resources (processor, I/O devices, etc.) are made available to multiple applications The processor in particular is switched among multiple applications

More information

CSCI-GA Operating Systems Lecture 3: Processes and Threads -Part 2 Scheduling Hubertus Franke

CSCI-GA Operating Systems Lecture 3: Processes and Threads -Part 2 Scheduling Hubertus Franke CSCI-GA.2250-001 Operating Systems Lecture 3: Processes and Threads -Part 2 Scheduling Hubertus Franke frankeh@cs.nyu.edu Processes Vs Threads The unit of dispatching is referred to as a thread or lightweight

More information

Lecture 5: Synchronization w/locks

Lecture 5: Synchronization w/locks Lecture 5: Synchronization w/locks CSE 120: Principles of Operating Systems Alex C. Snoeren Lab 1 Due 10/19 Threads Are Made to Share Global variables and static objects are shared Stored in the static

More information

Process Coordination and Shared Data

Process Coordination and Shared Data Process Coordination and Shared Data Lecture 19 In These Notes... Sharing data safely When multiple threads/processes interact in a system, new species of bugs arise 1. Compiler tries to save time by not

More information

FreeRTOS X. Task Notifications Semaphores Family Critical Section FreeRTOS Producer Consumer Tasks

FreeRTOS X. Task Notifications Semaphores Family Critical Section FreeRTOS Producer Consumer Tasks FreeRTOS X Task Notifications Semaphores Family Critical Section FreeRTOS Producer Consumer Tasks Task Notifications Semaphores Family Binary Semaphore Counting Semaphore Mutex Recursive Mutex Critical

More information

Roadmap. Tevfik Ko!ar. CSC Operating Systems Fall Lecture - III Processes. Louisiana State University. Processes. September 1 st, 2009

Roadmap. Tevfik Ko!ar. CSC Operating Systems Fall Lecture - III Processes. Louisiana State University. Processes. September 1 st, 2009 CSC 4103 - Operating Systems Fall 2009 Lecture - III Processes Tevfik Ko!ar Louisiana State University September 1 st, 2009 1 Roadmap Processes Basic Concepts Process Creation Process Termination Context

More information

Process Context & Interrupts. New process can mess up information in old process. (i.e. what if they both use the same register?)

Process Context & Interrupts. New process can mess up information in old process. (i.e. what if they both use the same register?) 1 Process Context 1.1 What is context? A process is sometimes called a task, subroutine or program. Process context is all the information that the process needs to keep track of its state. Registers Temporary

More information

Corso di Elettronica dei Sistemi Programmabili

Corso di Elettronica dei Sistemi Programmabili Corso di Elettronica dei Sistemi Programmabili Sistemi Operativi Real Time freertos implementation Aprile 2014 Stefano Salvatori 1/40 Sommario RTOS tick Execution context Context switch example 2/40 RTOS

More information

Operating Systems. Figure: Process States. 1 P a g e

Operating Systems. Figure: Process States. 1 P a g e 1. THE PROCESS CONCEPT A. The Process: A process is a program in execution. A process is more than the program code, which is sometimes known as the text section. It also includes the current activity,

More information

Lecture 3: Concurrency & Tasking

Lecture 3: Concurrency & Tasking Lecture 3: Concurrency & Tasking 1 Real time systems interact asynchronously with external entities and must cope with multiple threads of control and react to events - the executing programs need to share

More information

INF1060: Introduction to Operating Systems and Data Communication. Pål Halvorsen. Wednesday, September 29, 2010

INF1060: Introduction to Operating Systems and Data Communication. Pål Halvorsen. Wednesday, September 29, 2010 INF1060: Introduction to Operating Systems and Data Communication Pål Halvorsen Wednesday, September 29, 2010 Overview Processes primitives for creation and termination states context switches processes

More information

Concurrent Server Design Multiple- vs. Single-Thread

Concurrent Server Design Multiple- vs. Single-Thread Concurrent Server Design Multiple- vs. Single-Thread Chuan-Ming Liu Computer Science and Information Engineering National Taipei University of Technology Fall 2007, TAIWAN NTUT, TAIWAN 1 Examples Using

More information

Data Structures. Home

Data Structures. Home SYSTIMER Home Data Structures Data Structure Index Data Fields Data Structures Here are the data structures with brief descriptions: SYSTIMER This structure contains pointer which is used to hold CPU instance

More information

cs 140 project 1: threads 9 January 2015

cs 140 project 1: threads 9 January 2015 cs 140 project 1: threads 9 January 2015 git The basics: git clone git add git commit git branch git merge git stash git pull git push git rebase git Some guidelines & ideas: Write helpful commit and stash

More information

Processes and Threads

Processes and Threads OPERATING SYSTEMS CS3502 Spring 2018 Processes and Threads (Chapter 2) Processes Two important types of dynamic entities in a computer system are processes and threads. Dynamic entities only exist at execution

More information

Efficiency and memory footprint of Xilkernel for the Microblaze soft processor

Efficiency and memory footprint of Xilkernel for the Microblaze soft processor Efficiency and memory footprint of Xilkernel for the Microblaze soft processor Dariusz Caban, Institute of Informatics, Gliwice, Poland - June 18, 2014 The use of a real-time multitasking kernel simplifies

More information

Real-Time Programming

Real-Time Programming Real-Time Programming Week 7: Real-Time Operating Systems Instructors Tony Montiel & Ken Arnold rtp@hte.com 4/1/2003 Co Montiel 1 Objectives o Introduction to RTOS o Event Driven Systems o Synchronization

More information

CS 153 Design of Operating Systems Winter 2016

CS 153 Design of Operating Systems Winter 2016 CS 153 Design of Operating Systems Winter 2016 Lecture 6: Threads Recap: Process Components Per- Process State Per- Thread State A process is named using its process ID (PID) A process contains all of

More information

Process Concepts. CSC400 - Operating Systems. 3. Process Concepts. J. Sumey

Process Concepts. CSC400 - Operating Systems. 3. Process Concepts. J. Sumey CSC400 - Operating Systems 3. Process Concepts J. Sumey Overview Concurrency Processes & Process States Process Accounting Interrupts & Interrupt Processing Interprocess Communication CSC400 - Process

More information

V. 2. (http://www.tnkernel.com/) Copyright 2004, 2006 Yuri Tiomkin

V. 2. (http://www.tnkernel.com/) Copyright 2004, 2006 Yuri Tiomkin TNKernel Real-Time Kernel V. 2 (http://www.tnkernel.com/) Copyright 2004, 2006 Yuri Tiomkin Document Disclaimer The information in this document is subject to change without notice. While the information

More information

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst Operating Systems CMPSCI 377 Spring 2017 Mark Corner University of Massachusetts Amherst Multilevel Feedback Queues (MLFQ) Multilevel feedback queues use past behavior to predict the future and assign

More information

Cooperative Multitasking

Cooperative Multitasking Cooperative Multitasking Cooperative Multitasking let's make the controller for the lamp in an LCD projector Lamp off Fan off evbutton Lamp on Fan on evtimeout Lamp off Fan on evbutton Code for LCD Projector

More information

I/O Systems (3): Clocks and Timers. CSE 2431: Introduction to Operating Systems

I/O Systems (3): Clocks and Timers. CSE 2431: Introduction to Operating Systems I/O Systems (3): Clocks and Timers CSE 2431: Introduction to Operating Systems 1 Outline Clock Hardware Clock Software Soft Timers 2 Two Types of Clocks Simple clock: tied to the 110- or 220-volt power

More information

1 Introduction. 2 Managing contexts. Green, green threads of home. Johan Montelius HT2018

1 Introduction. 2 Managing contexts. Green, green threads of home. Johan Montelius HT2018 1 Introduction Green, green threads of home Johan Montelius HT2018 This is an assignment where you will implement your own thread library. Instead of using the operating systems threads you will create

More information