OPERATING SYSTEMS, ASSIGNMENT 2

Size: px
Start display at page:

Download "OPERATING SYSTEMS, ASSIGNMENT 2"

Transcription

1 OPERATING SYSTEMS, ASSIGNMENT 2 SIGNALS, USER THREADS and SYNCHRONIZATION Task 1: The Signals framework In order to support a mechanism (preemptive) for user space threads that will enable to switch control from an executing thread to the threads scheduler, we will use the signals mechanism. As you have seen in class, signals are a simple form of inter process communication (currently not implemented in xv6). In this part of the assignment, you will add the framework that will enable the passing of signals from one process to another. This implementation will cover the basic features needed for a signals framework, and despite its resemblance to the Linux framework it is far from being complete Updating the process data structure: The first step towards meeting this goal is to extend the proc struct located at proc.h. The struct should contain a field called pending that represents all currently unhandled (pending) signals. For example, when this field's value is 0x3 (the hex representation of the binary word ) then the process will eventually receive two signals whose identifier are 2 and 1. For simplicity, you may assume that your implementation will never have to support more than NUMSIG signals (you can find the appropriate definition at signals.h #define NUMSIG 32) Note that this representation means that multiple instances of a signal with the same type (having the same identifier) do not stack (are treated as a single signal). Each signal must also be associated with some action. To support this, add an array of NUMSIG entries where every entry is a pointer to a function. We require that every signal will have a default handler. This handler must only print the following message: A signal was accepted by process %pid%, where %pid% is the pid of the process.

2 1.2. Registering signal handlers: A process wishing to register a custom handler for a specific signal will use the following system call which you should add to xv6: int signal(int signum, sighandler_t handler) This system call will register a new handler for a given a signal number (signum). If successful, 0 is returned otherwise a -1 value is returned. The type sighandler_t should be defined as: typedef void (*sighandler_t)(void); 1.3. Sending a signal: So far, we have allowed a process to prepare itself for an incoming signal. Next we will add the ability to send a signal to a process. Add the following system call: int sigsend(int pid, int signum) Although kill is the standard name for the system call in charge of sending a signal, it is already used in xv6 for terminating processes. Given a process id (pid) and a signal number (signum), the sigsend system call will send the desired signal to the process pid. Upon successful completion, 0 will be returned. A -1 value will be returned in case of a failure Getting the process to handle the signal: Finally, you are to implement a mechanism which will make sure that a process receiving a signal actually executes the relevant signal handler. In your extension of xv6, a signal should be handled (if at all) whenever control is passed from the kernel to the process. That is, before restoring the process context, the kernel first checks for pending signals to that process and if needed it updates the instruction pointer (and stack pointer) by calling register_handler. This way, when the process receives its time slice, the code for the signal handler is executed. void register_handler(sighandler_t sighandler) { char* addr = uva2ka(proc->pgdir, (char*)proc->tf->esp); if ((proc->tf->esp & 0xFFF) == 0) panic("esp_offset == 0"); /* open a new frame */ *(int*)(addr + ((proc->tf->esp - 4) & 0xFFF)) = proc->tf->eip; proc->tf->esp -= 4; /* update eip */ proc->tf->eip = (uint)sighandler; }

3 The register_handler function is not native to xv6 and was added by the OS team to support the present assignment (you can find it in proc.c). The function locates the stack of the current process and opens a new frame. It must also update the old instruction pointer so that when the new code (sighandler) is completed the process normally resumes its execution. Notice that our implementation differs from real world signal handling schemes. In a real OS the kernel must not use the user stack (try to think why) and should return to kernel mode after executing the handler code in order to restore the process context Inheriting handlers to a child process: Modify the fork system call so that a child process will have the same registered signal handlers as its parent Implement the alarm system call void alarm(int ticks); The alarm system call shall cause the kernel to generate a SIGALRM (see signals.h) signal for the process after a given number of ticks (specified by the system call argument). Note: the scheduler may prevent the process from handling the signal as soon as it is generated If the argument ticks is 0, a pending alarm request, if any, is canceled. Alarm requests are not stacked; only one SIGALRM generation can be scheduled in this manner. If the SIGALRM signal has not yet been generated, the call shall result in rescheduling the time at which the SIGALRM signal is generated. You must use function prototypes and signals definitions from the signal.h file.

4 Task 2: User level threads User level threads (ULT) avoid using the kernel (and are transparent to it), and manage their own tables and their own scheduling algorithm (thus allowing more efficient, problem-specific scheduling). Context switching between threads within the same process is achieved by manipulating the stack pointer and registers. ULTs are usually cooperative, i.e. threads have to voluntarily give up the CPU by calling the thread_yield function. In this task you will implement preemptive (non-cooperative) user space threads User level threads package In order to manage threads within a process, a struct is required to represent a thread (much like a PCB for a process). We will refer to this as the thread control block (TCB). Such a struct should look something like the following: struct uthread { int tid; /* thread's id */ uint esp; /* current stack pointer register */ uint ebp; /* current base pointer register */ void* stack; /* the thread's stack */ uthread_state state; /* thread's state: running, runnable, waiting */ }; You may add any fields you see fit to the above struct. This type and the prototypes of the ULT package API functions are defined for you in the uthread.h file, which we added to the current revision in the svn repository. The threads framework must maintain a table of the threads that exist within the process. You can define a static array for this purpose, whose size will be defined by the MAX_UTHREADS=64 macro (defined in uthread.h as well). The application programming interface (API) of your threads package has to include the following functions: 2.2. int uthread_init(); This function must be called by the process (that wants to use the uthread library). This function performs the following: Initializes the thread table Creates the main thread Registers the SIGALRM handler to the uthread_yield function Executes the alarm system call with UTHREAD_QUANTA=5

5 After performing the initialization steps you are free to use the uthread library int uthread_create(void (*start_func)(void *), void*arg); This function receives as arguments a pointer to the thread s entry function and an argument for it. The function should allocate space for the thread, initialize it but not run it just yet. Once the thread s fields are all initialized, the thread is inserted into the threads table. The function returns the identifier of the newly created thread or - 1 in case of a failure. Don t forget to allocate space for the thread s stack. A size of a single page (4096 bytes) should suffice. Consider what happens when the thread s entry function finishes: does it have an address to return to? Hint: you can o Wrap the entry function, so that a thread_exit call will be carried out implicitly after the entry function finishes o On thread creation, push the thread_exit as the return address void uthread_yield(); This function picks up the next thread from the threads table, according to the scheduling policy (explained later), and restores its context. The context of a ULT includes a unique call stack, a pointer to its top (stack pointer) and a set of other registers. The context restore is merely switching the active stack of the process by changing the value of esp. To clarify this, consider a scenario where thread A calls uthread_yield and the next thread to run is thread B. Assuming thread B already ran before and called uthread_yield in the past (to allow thread A or another thread to run), its stack should contain the values defining the frame to which it should return when continued. After the stacks are switched, and the execution continues, thread B continues to execute the code of uthread_yield, and when it reaches the closing bracket it returns to the point (ret address on its stack) where it made the call to uthread_yield and continues to run. See figure below.

6 Figure 1: depicts the stacks of threads A and B, executing functions fooa and foob respectively. Thread A calls uthread_yield. The value of the esp register should be changed to point to the top of stack of thread B, so uthread_yield will return to the next instruction in foob (after the call to uthread_yield). Tip: backing-up and restoring esp and performing stack related operations requires inlining assembly code into your C code void uthread_exit(); Terminates the calling thread and transfers control to some other thread (similar to yield). Don t forget to clear the terminated thread from the threads table, and free any resources used by it (the stack, in our case). When the last thread in the process calls uthread_exit the process should terminate (i.e. exit should be called) int uthred_self(); Returns the thread id associated with the calling thread int uthred_join(int tid); The uthread_join function waits for the thread specified by tid to terminate. If that thread has already terminated, then uthread_join returns immediately. Scheduling policy: Your threads package should support a round-robin scheduling policy where threads are scheduled in a cyclic manner. For more information about basic assembly operations (and conventions) you can refer to:

7 Task 3: Binary (fair) Semaphores In this part of the assignment you will add functionality that allows users to create and use binary semaphores. Before you start your implementation, you can examine the implementation of spinlocks in the XV6's kernel (for example the wait uses a spinlock). Spinlocks are used in XV6 in order to synchronize kernel cores while they (the spinlocks) do not change the status of processes. Your task is to implement binary semaphores as a user service. The semantics of binary semaphores were described in class and include the two operations described below. Add the following functions to your threads package: 3.1. void binary_semaphore_init(struct binary_semaphore* semaphore, int value); This function initializes a binary semaphore with the given initial value. Notice that spinlocks are not the same as fair binary semaphores, for example starvation can happen with spinlocks but not with semaphores due to the queue of waiting threads that the semaphore maintains void binary_semaphore_down(struct binary_semaphore* semaphore); 3.3. void binary_semaphore_up(struct binary_semaphore* semaphore); The functions binary_semaphore_down and binary_semaphore_up work as learned in class.

8 Task 4: A Synchronization problem In this task you will implement a solution to the Firing Squad Synchronization Problem (FSSP) using the synchronization primitives from task 3. The FSSP problem description (as described by R.M Balzer): Consider a finite one dimensional array of finite state machines, all of which are alike except the ones at each end. The machines are called soldiers and one of the end machines is called a general. The machines are synchronous, and the state of each machine at time t + 1 depends on the states of itself and of its two neighbors at time t. The problem is to specify the states and transitions of the soldiers in such a way that the general can cause them to go into one particular terminal state (i.e., they fire their guns) all at exactly the same time. At the beginning (i.e., t = 0) all the soldiers are assumed to be in a single state, the quiescent state. When the general undergoes the transition into the state labeled "fire when ready", it does not take any initiative afterwards and the rest is up to the soldiers. The signal can propagate down the line no faster than one soldier per unit of time and their problem is how to get all coordinated and in rhythm. The tricky part of the problem is that the same kind of soldier with a fixed number, k, of states is required to be able to do this regardless of the length, n, of the firing squad. In particular, the soldier with k states should work correctly, even when n is much larger than k. Two of the soldiers, the general and the soldier farthest from the general, are allowed to be slightly different from the other soldiers in being able to act without having soldiers on both sides of them. A convenient way of indicating a solution of this problem is to use a piece of graph paper with the horizontal coordinate representing the spatial position and the vertical coordinate representing the time. Within the (i,j) square of the graph paper a symbol may be written indicating the state of the i'th soldier at time j. Visual examination of the pattern of the propagation of these symbols can indicate what kind of signaling must take place between the soldiers. The figure below shows one solution to the FSSP using 15 states and 3n units of time. Each state is represented by a different color. Time increases from top to bottom.

9 Write a user space program that: Receives the number of soldiers by an argument. Each soldier is represented by a thread. Each state is represented by a number. The process's main thread is in charge of synchronizing the threads steps (In the problem description the system of machines is synchronous). At each time, t, several actions need to be done in a synchronized matter: All soldiers change their state according to their transitions function. All soldiers write the number corresponding to their new state in a shared array. The main thread prints the array (every iteration). You have complete freedom to choose the algorithm you choose to implement in order to solve the FSSP. Consider using the algorithm proposed by John McCarthy and Marvin Minsky.

10 Submission guidelines Assignment due date: 27/04/2014 Make sure that your Makefile is properly updated and that your code compiles with no warnings whatsoever. We strongly recommend documenting your code changes with remarks these are often handy when discussing your code with the graders. Due to our constrained resources, assignments are only allowed in pairs. Please note this important point and try to match up with a partner as soon as possible. Submissions are only allowed through the submission system. To avoid submitting a large number of xv6 builds you are required to submit a patch (i.e. a file which patches the original xv6 and applies all your changes). You may use the following instructions to guide you through the process: Back-up your work before proceeding! Before creating the patch review the change list and make sure it contains all the changes that you applied and nothing more. Modified files are automatically detected by svn but new files should be added explicitly with the svn add command: > svn add <filename> In case you need to revert to a previous version: > svn revert <filename> At this point you may examine the differences (the patch): > svn diff Alternatively, if you have a diff utility such as kompare: > svn diff kompare o Once you are ready to create a patch simply make sure the output is redirected to the patch file: > svn diff > ID1_ID2.patch Tip: Although the graders will only apply your latest patch file, the submission system supports multiple uploads. Use this feature often and make sure you upload patches of your current work even if you haven t completed the assignment. Finally, you should note that the graders are instructed to examine your code on lab computers only(!) - Test your code on lab computers prior to submission. Enjoy!

Process definition Concurrency Process status Process attributes PROCESES 1.3

Process definition Concurrency Process status Process attributes PROCESES 1.3 Process Management Outline Main concepts Basic services for process management (Linux based) Inter process communications: Linux Signals and synchronization Internal process management Basic data structures:

More information

Linux Process Scheduling Policy

Linux Process Scheduling Policy Lecture Overview Introduction to Linux process scheduling Policy versus algorithm Linux overall process scheduling objectives Timesharing Dynamic priority Favor I/O-bound process Linux scheduling algorithm

More information

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

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

More information

First-class User Level Threads

First-class User Level Threads First-class User Level Threads based on paper: First-Class User Level Threads by Marsh, Scott, LeBlanc, and Markatos research paper, not merely an implementation report User-level Threads Threads managed

More information

Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C

Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C 1 An essential part of any embedded system design Programming 2 Programming in Assembly or HLL Processor and memory-sensitive

More information

ELEC 377. Operating Systems. Week 1 Class 3

ELEC 377. Operating Systems. Week 1 Class 3 Operating Systems Week 1 Class 3 Last Class! Computer System Structure, Controllers! Interrupts & Traps! I/O structure and device queues.! Storage Structure & Caching! Hardware Protection! Dual Mode Operation

More information

Chapter 2: OS Overview

Chapter 2: OS Overview Chapter 2: OS Overview CmSc 335 Operating Systems 1. Operating system objectives and functions Operating systems control and support the usage of computer systems. a. usage users of a computer system:

More information

Priority Based Implementation in Pintos

Priority Based Implementation in Pintos Priority Based Implementation in Pintos Deepa D 1, Nivas K S 2, Preethi V 3 1, 2, 3 Students M-Tech, Dept. of Information Technology, SNS College of Engg., Coimbatore. Abstract Pintos is a simple operating

More information

Operating Systems. 05. Threads. Paul Krzyzanowski. Rutgers University. Spring 2015

Operating Systems. 05. Threads. Paul Krzyzanowski. Rutgers University. Spring 2015 Operating Systems 05. Threads Paul Krzyzanowski Rutgers University Spring 2015 February 9, 2015 2014-2015 Paul Krzyzanowski 1 Thread of execution Single sequence of instructions Pointed to by the program

More information

Threads Scheduling on Linux Operating Systems

Threads Scheduling on Linux Operating Systems Threads Scheduling on Linux Operating Systems Igli Tafa 1, Stavri Thomollari 2, Julian Fejzaj 3 Polytechnic University of Tirana, Faculty of Information Technology 1,2 University of Tirana, Faculty of

More information

Program 5 - Processes and Signals (100 points)

Program 5 - Processes and Signals (100 points) Program 5 - Processes and Signals (100 points) COMPSCI 253: Intro to Systems Programming 1 Objectives Using system calls to create and manage processes under Linux and Microsoft Windows Using Visual Studio

More information

Operating Systems Concepts: Chapter 7: Scheduling Strategies

Operating Systems Concepts: Chapter 7: Scheduling Strategies Operating Systems Concepts: Chapter 7: Scheduling Strategies Olav Beckmann Huxley 449 http://www.doc.ic.ac.uk/~ob3 Acknowledgements: There are lots. See end of Chapter 1. Home Page for the course: http://www.doc.ic.ac.uk/~ob3/teaching/operatingsystemsconcepts/

More information

Libmonitor: A Tool for First-Party Monitoring

Libmonitor: A Tool for First-Party Monitoring Libmonitor: A Tool for First-Party Monitoring Mark W. Krentel Dept. of Computer Science Rice University 6100 Main St., Houston, TX 77005 krentel@rice.edu ABSTRACT Libmonitor is a library that provides

More information

Jorix kernel: real-time scheduling

Jorix kernel: real-time scheduling Jorix kernel: real-time scheduling Joris Huizer Kwie Min Wong May 16, 2007 1 Introduction As a specialized part of the kernel, we implemented two real-time scheduling algorithms: RM (rate monotonic) and

More information

Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY. 6.828 Operating System Engineering: Fall 2005

Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY. 6.828 Operating System Engineering: Fall 2005 Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY 6.828 Operating System Engineering: Fall 2005 Quiz II Solutions Average 84, median 83, standard deviation

More information

SYSTEM ecos Embedded Configurable Operating System

SYSTEM ecos Embedded Configurable Operating System BELONGS TO THE CYGNUS SOLUTIONS founded about 1989 initiative connected with an idea of free software ( commercial support for the free software ). Recently merged with RedHat. CYGNUS was also the original

More information

Introduction to Data Structures

Introduction to Data Structures Introduction to Data Structures Albert Gural October 28, 2011 1 Introduction When trying to convert from an algorithm to the actual code, one important aspect to consider is how to store and manipulate

More information

Process Scheduling CS 241. February 24, 2012. Copyright University of Illinois CS 241 Staff

Process Scheduling CS 241. February 24, 2012. Copyright University of Illinois CS 241 Staff Process Scheduling CS 241 February 24, 2012 Copyright University of Illinois CS 241 Staff 1 Announcements Mid-semester feedback survey (linked off web page) MP4 due Friday (not Tuesday) Midterm Next Tuesday,

More information

CS414 SP 2007 Assignment 1

CS414 SP 2007 Assignment 1 CS414 SP 2007 Assignment 1 Due Feb. 07 at 11:59pm Submit your assignment using CMS 1. Which of the following should NOT be allowed in user mode? Briefly explain. a) Disable all interrupts. b) Read the

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 1 Concurrency and Process Challenge: Physical reality is Concurrent Smart to do concurrent software instead of sequential? At least we want to have

More information

How To Understand How A Process Works In Unix (Shell) (Shell Shell) (Program) (Unix) (For A Non-Program) And (Shell).Orgode) (Powerpoint) (Permanent) (Processes

How To Understand How A Process Works In Unix (Shell) (Shell Shell) (Program) (Unix) (For A Non-Program) And (Shell).Orgode) (Powerpoint) (Permanent) (Processes Content Introduction and History File I/O The File System Shell Programming Standard Unix Files and Configuration Processes Programs are instruction sets stored on a permanent medium (e.g. harddisc). Processes

More information

Linux Scheduler. Linux Scheduler

Linux Scheduler. Linux Scheduler or or Affinity Basic Interactive es 1 / 40 Reality... or or Affinity Basic Interactive es The Linux scheduler tries to be very efficient To do that, it uses some complex data structures Some of what it

More information

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

KITES TECHNOLOGY COURSE MODULE (C, C++, DS) KITES TECHNOLOGY 360 Degree Solution www.kitestechnology.com/academy.php info@kitestechnology.com technologykites@gmail.com Contact: - 8961334776 9433759247 9830639522.NET JAVA WEB DESIGN PHP SQL, PL/SQL

More information

RTOS Debugger for ecos

RTOS Debugger for ecos RTOS Debugger for ecos TRACE32 Online Help TRACE32 Directory TRACE32 Index TRACE32 Documents... RTOS Debugger... RTOS Debugger for ecos... 1 Overview... 2 Brief Overview of Documents for New Users... 3

More information

ò Paper reading assigned for next Thursday ò Lab 2 due next Friday ò What is cooperative multitasking? ò What is preemptive multitasking?

ò Paper reading assigned for next Thursday ò Lab 2 due next Friday ò What is cooperative multitasking? ò What is preemptive multitasking? Housekeeping Paper reading assigned for next Thursday Scheduling Lab 2 due next Friday Don Porter CSE 506 Lecture goals Undergrad review Understand low-level building blocks of a scheduler Understand competing

More information

Stack Allocation. Run-Time Data Structures. Static Structures

Stack Allocation. Run-Time Data Structures. Static Structures Run-Time Data Structures Stack Allocation Static Structures For static structures, a fixed address is used throughout execution. This is the oldest and simplest memory organization. In current compilers,

More information

Lab Experience 17. Programming Language Translation

Lab Experience 17. Programming Language Translation Lab Experience 17 Programming Language Translation Objectives Gain insight into the translation process for converting one virtual machine to another See the process by which an assembler translates assembly

More information

Exceptions in MIPS. know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine

Exceptions in MIPS. know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine 7 Objectives After completing this lab you will: know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine Introduction Branches and jumps provide ways to change

More information

6.828 Operating System Engineering: Fall 2003. Quiz II Solutions THIS IS AN OPEN BOOK, OPEN NOTES QUIZ.

6.828 Operating System Engineering: Fall 2003. Quiz II Solutions THIS IS AN OPEN BOOK, OPEN NOTES QUIZ. Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY 6.828 Operating System Engineering: Fall 2003 Quiz II Solutions All problems are open-ended questions. In

More information

Dalhousie University CSCI 2132 Software Development Winter 2015 Lab 7, March 11

Dalhousie University CSCI 2132 Software Development Winter 2015 Lab 7, March 11 Dalhousie University CSCI 2132 Software Development Winter 2015 Lab 7, March 11 In this lab, you will first learn how to use pointers to print memory addresses of variables. After that, you will learn

More information

Performance Evaluation and Optimization of A Custom Native Linux Threads Library

Performance Evaluation and Optimization of A Custom Native Linux Threads Library Center for Embedded Computer Systems University of California, Irvine Performance Evaluation and Optimization of A Custom Native Linux Threads Library Guantao Liu and Rainer Dömer Technical Report CECS-12-11

More information

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study CS 377: Operating Systems Lecture 25 - Linux Case Study Guest Lecturer: Tim Wood Outline Linux History Design Principles System Overview Process Scheduling Memory Management File Systems A review of what

More information

The Linux Kernel: Process Management. CS591 (Spring 2001)

The Linux Kernel: Process Management. CS591 (Spring 2001) The Linux Kernel: Process Management Process Descriptors The kernel maintains info about each process in a process descriptor, of type task_struct. See include/linux/sched.h Each process descriptor contains

More information

Implementing and testing tftp

Implementing and testing tftp CSE123 Spring 2013 Term Project Implementing and testing tftp Project Description Checkpoint: May 10, 2013 Due: May 29, 2013 For this project you will program a client/server network application in C on

More information

OPERATING SYSTEM SERVICES

OPERATING SYSTEM SERVICES OPERATING SYSTEM SERVICES USER INTERFACE Command line interface(cli):uses text commands and a method for entering them Batch interface(bi):commands and directives to control those commands are entered

More information

Outline. Review. Inter process communication Signals Fork Pipes FIFO. Spotlights

Outline. Review. Inter process communication Signals Fork Pipes FIFO. Spotlights Outline Review Inter process communication Signals Fork Pipes FIFO Spotlights 1 6.087 Lecture 14 January 29, 2010 Review Inter process communication Signals Fork Pipes FIFO Spotlights 2 Review: multithreading

More information

CSI 402 Lecture 13 (Unix Process Related System Calls) 13 1 / 17

CSI 402 Lecture 13 (Unix Process Related System Calls) 13 1 / 17 CSI 402 Lecture 13 (Unix Process Related System Calls) 13 1 / 17 System Calls for Processes Ref: Process: Chapter 5 of [HGS]. A program in execution. Several processes are executed concurrently by the

More information

THE UNIVERSITY OF AUCKLAND

THE UNIVERSITY OF AUCKLAND THE UNIVERSITY OF AUCKLAND 07.340 T07.340 EXAMINATION FOR BA BSc ETC 1995 COMPUTER SCIENCE Operating Systems ( Time allowed : THREE hours ) NOTES: Answer SIX questions. The total mark for each question

More information

Scheduling policy. ULK3e 7.1. Operating Systems: Scheduling in Linux p. 1

Scheduling policy. ULK3e 7.1. Operating Systems: Scheduling in Linux p. 1 Scheduling policy ULK3e 7.1 Goals fast process response time good throughput for background jobs avoidance of process starvation reconciliation of needs of low- and high-priority processes Operating Systems:

More information

Chapter 12. Development Tools for Microcontroller Applications

Chapter 12. Development Tools for Microcontroller Applications Chapter 12 Development Tools for Microcontroller Applications Lesson 01 Software Development Process and Development Tools Step 1: Development Phases Analysis Design Implementation Phase 1 Phase 2 Phase

More information

REAL TIME OPERATING SYSTEM PROGRAMMING-II: II: Windows CE, OSEK and Real time Linux. Lesson-12: Real Time Linux

REAL TIME OPERATING SYSTEM PROGRAMMING-II: II: Windows CE, OSEK and Real time Linux. Lesson-12: Real Time Linux REAL TIME OPERATING SYSTEM PROGRAMMING-II: II: Windows CE, OSEK and Real time Linux Lesson-12: Real Time Linux 1 1. Real Time Linux 2 Linux 2.6.x Linux is after Linus Torvalds, father of the Linux operating

More information

Lab 4: Socket Programming: netcat part

Lab 4: Socket Programming: netcat part Lab 4: Socket Programming: netcat part Overview The goal of this lab is to familiarize yourself with application level programming with sockets, specifically stream or TCP sockets, by implementing a client/server

More information

Operating Systems and Networks

Operating Systems and Networks recap Operating Systems and Networks How OS manages multiple tasks Virtual memory Brief Linux demo Lecture 04: Introduction to OS-part 3 Behzad Bordbar 47 48 Contents Dual mode API to wrap system calls

More information

Introduction. What is an Operating System?

Introduction. What is an Operating System? Introduction What is an Operating System? 1 What is an Operating System? 2 Why is an Operating System Needed? 3 How Did They Develop? Historical Approach Affect of Architecture 4 Efficient Utilization

More information

An Implementation Of Multiprocessor Linux

An Implementation Of Multiprocessor Linux An Implementation Of Multiprocessor Linux This document describes the implementation of a simple SMP Linux kernel extension and how to use this to develop SMP Linux kernels for architectures other than

More information

Migration of Process Credentials

Migration of Process Credentials C H A P T E R - 5 Migration of Process Credentials 5.1 Introduction 5.2 The Process Identifier 5.3 The Mechanism 5.4 Concluding Remarks 100 CHAPTER 5 Migration of Process Credentials 5.1 Introduction Every

More information

SYSTEMS OF EQUATIONS AND MATRICES WITH THE TI-89. by Joseph Collison

SYSTEMS OF EQUATIONS AND MATRICES WITH THE TI-89. by Joseph Collison SYSTEMS OF EQUATIONS AND MATRICES WITH THE TI-89 by Joseph Collison Copyright 2000 by Joseph Collison All rights reserved Reproduction or translation of any part of this work beyond that permitted by Sections

More information

Kernel Synchronization and Interrupt Handling

Kernel Synchronization and Interrupt Handling Kernel Synchronization and Interrupt Handling Oliver Sengpie, Jan van Esdonk Arbeitsbereich Wissenschaftliches Rechnen Fachbereich Informatik Fakultt fr Mathematik, Informatik und Naturwissenschaften Universitt

More information

Introduction to Eclipse

Introduction to Eclipse Introduction to Eclipse Overview Eclipse Background Obtaining and Installing Eclipse Creating a Workspaces / Projects Creating Classes Compiling and Running Code Debugging Code Sampling of Features Summary

More information

sys socketcall: Network systems calls on Linux

sys socketcall: Network systems calls on Linux sys socketcall: Network systems calls on Linux Daniel Noé April 9, 2008 The method used by Linux for system calls is explored in detail in Understanding the Linux Kernel. However, the book does not adequately

More information

Linux scheduler history. We will be talking about the O(1) scheduler

Linux scheduler history. We will be talking about the O(1) scheduler CPU Scheduling Linux scheduler history We will be talking about the O(1) scheduler SMP Support in 2.4 and 2.6 versions 2.4 Kernel 2.6 Kernel CPU1 CPU2 CPU3 CPU1 CPU2 CPU3 Linux Scheduling 3 scheduling

More information

Tasks Schedule Analysis in RTAI/Linux-GPL

Tasks Schedule Analysis in RTAI/Linux-GPL Tasks Schedule Analysis in RTAI/Linux-GPL Claudio Aciti and Nelson Acosta INTIA - Depto de Computación y Sistemas - Facultad de Ciencias Exactas Universidad Nacional del Centro de la Provincia de Buenos

More information

Interprocess Communication Message Passing

Interprocess Communication Message Passing Interprocess Communication Message Passing IPC facility provides two operations: send(message) message size fixed or variable receive(message) If P and Q wish to communicate, they need to: establish a

More information

Real Time Programming: Concepts

Real Time Programming: Concepts Real Time Programming: Concepts Radek Pelánek Plan at first we will study basic concepts related to real time programming then we will have a look at specific programming languages and study how they realize

More information

Operating System Manual. Realtime Communication System for netx. Kernel API Function Reference. www.hilscher.com.

Operating System Manual. Realtime Communication System for netx. Kernel API Function Reference. www.hilscher.com. Operating System Manual Realtime Communication System for netx Kernel API Function Reference Language: English www.hilscher.com rcx - Kernel API Function Reference 2 Copyright Information Copyright 2005-2007

More information

Operating System: Scheduling

Operating System: Scheduling Process Management Operating System: Scheduling OS maintains a data structure for each process called Process Control Block (PCB) Information associated with each PCB: Process state: e.g. ready, or waiting

More information

ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER

ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER Pierre A. von Kaenel Mathematics and Computer Science Department Skidmore College Saratoga Springs, NY 12866 (518) 580-5292 pvonk@skidmore.edu ABSTRACT This paper

More information

How To Port A Program To Dynamic C (C) (C-Based) (Program) (For A Non Portable Program) (Un Portable) (Permanent) (Non Portable) C-Based (Programs) (Powerpoint)

How To Port A Program To Dynamic C (C) (C-Based) (Program) (For A Non Portable Program) (Un Portable) (Permanent) (Non Portable) C-Based (Programs) (Powerpoint) TN203 Porting a Program to Dynamic C Introduction Dynamic C has a number of improvements and differences compared to many other C compiler systems. This application note gives instructions and suggestions

More information

Objectives. Chapter 2: Operating-System Structures. Operating System Services (Cont.) Operating System Services. Operating System Services (Cont.

Objectives. Chapter 2: Operating-System Structures. Operating System Services (Cont.) Operating System Services. Operating System Services (Cont. Objectives To describe the services an operating system provides to users, processes, and other systems To discuss the various ways of structuring an operating system Chapter 2: Operating-System Structures

More information

Thread Synchronization and the Java Monitor

Thread Synchronization and the Java Monitor Articles News Weblogs Buzz Chapters Forums Table of Contents Order the Book Print Email Screen Friendly Version Previous Next Chapter 20 of Inside the Java Virtual Machine Thread Synchronization by Bill

More information

Replication on Virtual Machines

Replication on Virtual Machines Replication on Virtual Machines Siggi Cherem CS 717 November 23rd, 2004 Outline 1 Introduction The Java Virtual Machine 2 Napper, Alvisi, Vin - DSN 2003 Introduction JVM as state machine Addressing non-determinism

More information

Using Power to Improve C Programming Education

Using Power to Improve C Programming Education Using Power to Improve C Programming Education Jonas Skeppstedt Department of Computer Science Lund University Lund, Sweden jonas.skeppstedt@cs.lth.se jonasskeppstedt.net jonasskeppstedt.net jonas.skeppstedt@cs.lth.se

More information

Multiprocessor Scheduling and Scheduling in Linux Kernel 2.6

Multiprocessor Scheduling and Scheduling in Linux Kernel 2.6 Multiprocessor Scheduling and Scheduling in Linux Kernel 2.6 Winter Term 2008 / 2009 Jun.-Prof. Dr. André Brinkmann Andre.Brinkmann@uni-paderborn.de Universität Paderborn PC² Agenda Multiprocessor and

More information

CPU Scheduling Outline

CPU Scheduling Outline CPU Scheduling Outline What is scheduling in the OS? What are common scheduling criteria? How to evaluate scheduling algorithms? What are common scheduling algorithms? How is thread scheduling different

More information

C Programming Review & Productivity Tools

C Programming Review & Productivity Tools Review & Productivity Tools Giovanni Agosta Piattaforme Software per la Rete Modulo 2 Outline Preliminaries 1 Preliminaries 2 Function Pointers Variadic Functions 3 Build Automation Code Versioning 4 Preliminaries

More information

Scheduling. Yücel Saygın. These slides are based on your text book and on the slides prepared by Andrew S. Tanenbaum

Scheduling. Yücel Saygın. These slides are based on your text book and on the slides prepared by Andrew S. Tanenbaum Scheduling Yücel Saygın These slides are based on your text book and on the slides prepared by Andrew S. Tanenbaum 1 Scheduling Introduction to Scheduling (1) Bursts of CPU usage alternate with periods

More information

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture Last Class: OS and Computer Architecture System bus Network card CPU, memory, I/O devices, network card, system bus Lecture 3, page 1 Last Class: OS and Computer Architecture OS Service Protection Interrupts

More information

Distributed Version Control

Distributed Version Control Distributed Version Control Faisal Tameesh April 3 rd, 2015 Executive Summary Version control is a cornerstone of modern software development. As opposed to the centralized, client-server architecture

More information

10.04.2008. Thomas Fahrig Senior Developer Hypervisor Team. Hypervisor Architecture Terminology Goals Basics Details

10.04.2008. Thomas Fahrig Senior Developer Hypervisor Team. Hypervisor Architecture Terminology Goals Basics Details Thomas Fahrig Senior Developer Hypervisor Team Hypervisor Architecture Terminology Goals Basics Details Scheduling Interval External Interrupt Handling Reserves, Weights and Caps Context Switch Waiting

More information

EE8205: Embedded Computer System Electrical and Computer Engineering, Ryerson University. Multitasking ARM-Applications with uvision and RTX

EE8205: Embedded Computer System Electrical and Computer Engineering, Ryerson University. Multitasking ARM-Applications with uvision and RTX EE8205: Embedded Computer System Electrical and Computer Engineering, Ryerson University Multitasking ARM-Applications with uvision and RTX 1. Objectives The purpose of this lab is to lab is to introduce

More information

CNC Transfer. Operating Manual

CNC Transfer. Operating Manual Rank Brothers Ltd CNC Transfer Operating Manual Manufactured by: Rank Brothers Ltd 56 High Street, Bottisham, Cambridge CB25 9DA, England Tel: +44 (0)1223 811369 Fax: +44 (0)1223 811441 Website: http://www.rankbrothers.co.uk/

More information

sel4: from Security to Safety Gernot Heiser, Anna Lyons NICTA and UNSW Australia

sel4: from Security to Safety Gernot Heiser, Anna Lyons NICTA and UNSW Australia sel4: from Security to Safety Gernot Heiser, Anna Lyons NICTA and UNSW Australia 1 OS Trade-Offs Usability Minix Android Linux Trustworthiness Minix Android L4 sel4 Performance Linux L4 sel4 2015 Gernot

More information

CPE453 Laboratory Assignment #2 The CPE453 Monitor

CPE453 Laboratory Assignment #2 The CPE453 Monitor CPE453 Laboratory Assignment #2 The CPE453 Monitor Michael Haungs, Spring 2011 1 Objective As multi-core CPUs become commonplace, there is an increasing need to parallelize legacy applications. In this

More information

3.5. cmsg Developer s Guide. Data Acquisition Group JEFFERSON LAB. Version

3.5. cmsg Developer s Guide. Data Acquisition Group JEFFERSON LAB. Version Version 3.5 JEFFERSON LAB Data Acquisition Group cmsg Developer s Guide J E F F E R S O N L A B D A T A A C Q U I S I T I O N G R O U P cmsg Developer s Guide Elliott Wolin wolin@jlab.org Carl Timmer timmer@jlab.org

More information

Road Map. Scheduling. Types of Scheduling. Scheduling. CPU Scheduling. Job Scheduling. Dickinson College Computer Science 354 Spring 2010.

Road Map. Scheduling. Types of Scheduling. Scheduling. CPU Scheduling. Job Scheduling. Dickinson College Computer Science 354 Spring 2010. Road Map Scheduling Dickinson College Computer Science 354 Spring 2010 Past: What an OS is, why we have them, what they do. Base hardware and support for operating systems Process Management Threads Present:

More information

I/O Device and Drivers

I/O Device and Drivers COS 318: Operating Systems I/O Device and Drivers Prof. Margaret Martonosi Computer Science Department Princeton University http://www.cs.princeton.edu/courses/archive/fall11/cos318/ Announcements Project

More information

Performance Comparison of RTOS

Performance Comparison of RTOS Performance Comparison of RTOS Shahmil Merchant, Kalpen Dedhia Dept Of Computer Science. Columbia University Abstract: Embedded systems are becoming an integral part of commercial products today. Mobile

More information

Umbraco v4 Editors Manual

Umbraco v4 Editors Manual Umbraco v4 Editors Manual Produced by the Umbraco Community Umbraco // The Friendly CMS Contents 1 Introduction... 3 2 Getting Started with Umbraco... 4 2.1 Logging On... 4 2.2 The Edit Mode Interface...

More information

The Real-Time Operating System ucos-ii

The Real-Time Operating System ucos-ii The Real-Time Operating System ucos-ii Enric Pastor Dept. Arquitectura de Computadors µc/os-ii Overview µc/os-ii Task Management Rate Monotonic Scheduling Memory Management µc/gui µc/fs Books and Resources

More information

Chapter 5 Linux Load Balancing Mechanisms

Chapter 5 Linux Load Balancing Mechanisms Chapter 5 Linux Load Balancing Mechanisms Load balancing mechanisms in multiprocessor systems have two compatible objectives. One is to prevent processors from being idle while others processors still

More information

3 - Lift with Monitors

3 - Lift with Monitors 3 - Lift with Monitors TSEA81 - Computer Engineering and Real-time Systems This document is released - 2015-11-24 version 1.4 Author - Ola Dahl, Andreas Ehliar Assignment - 3 - Lift with Monitors Introduction

More information

Chapter 3 Operating-System Structures

Chapter 3 Operating-System Structures Contents 1. Introduction 2. Computer-System Structures 3. Operating-System Structures 4. Processes 5. Threads 6. CPU Scheduling 7. Process Synchronization 8. Deadlocks 9. Memory Management 10. Virtual

More information

6-1. Process Modeling

6-1. Process Modeling 6-1 Process Modeling Key Definitions Process model A formal way of representing how a business system operates Illustrates the activities that are performed and how data moves among them Data flow diagramming

More information

13 Classes & Objects with Constructors/Destructors

13 Classes & Objects with Constructors/Destructors 13 Classes & Objects with Constructors/Destructors 13.1 Introduction In object oriented programming, the emphasis is on data rather than function. Class is a way that binds the data & function together.

More information

Green Telnet. Making the Client/Server Model Green

Green Telnet. Making the Client/Server Model Green Green Telnet Reducing energy consumption is of growing importance. Jeremy and Ken create a "green telnet" that lets clients transition to a low-power, sleep state. By Jeremy Blackburn and Ken Christensen,

More information

2) Write in detail the issues in the design of code generator.

2) Write in detail the issues in the design of code generator. COMPUTER SCIENCE AND ENGINEERING VI SEM CSE Principles of Compiler Design Unit-IV Question and answers UNIT IV CODE GENERATION 9 Issues in the design of code generator The target machine Runtime Storage

More information

Back-up Server DOC-OEMSPP-S/2014-BUS-EN-10/12/13

Back-up Server DOC-OEMSPP-S/2014-BUS-EN-10/12/13 Back-up Server DOC-OEMSPP-S/2014-BUS-EN-10/12/13 The information contained in this guide is not of a contractual nature and may be subject to change without prior notice. The software described in this

More information

Stack machines The MIPS assembly language A simple source language Stack-machine implementation of the simple language Readings: 9.1-9.

Stack machines The MIPS assembly language A simple source language Stack-machine implementation of the simple language Readings: 9.1-9. Code Generation I Stack machines The MIPS assembly language A simple source language Stack-machine implementation of the simple language Readings: 9.1-9.7 Stack Machines A simple evaluation model No variables

More information

The System Monitor Handbook. Chris Schlaeger John Tapsell Chris Schlaeger Tobias Koenig

The System Monitor Handbook. Chris Schlaeger John Tapsell Chris Schlaeger Tobias Koenig Chris Schlaeger John Tapsell Chris Schlaeger Tobias Koenig 2 Contents 1 Introduction 6 2 Using System Monitor 7 2.1 Getting started........................................ 7 2.2 Process Table.........................................

More information

Chapter 3: Operating-System Structures. System Components Operating System Services System Calls System Programs System Structure Virtual Machines

Chapter 3: Operating-System Structures. System Components Operating System Services System Calls System Programs System Structure Virtual Machines Chapter 3: Operating-System Structures System Components Operating System Services System Calls System Programs System Structure Virtual Machines Operating System Concepts 3.1 Common System Components

More information

C++ INTERVIEW QUESTIONS

C++ INTERVIEW QUESTIONS C++ INTERVIEW QUESTIONS http://www.tutorialspoint.com/cplusplus/cpp_interview_questions.htm Copyright tutorialspoint.com Dear readers, these C++ Interview Questions have been designed specially to get

More information

Using Microsoft Visual Studio 2010. API Reference

Using Microsoft Visual Studio 2010. API Reference 2010 API Reference Published: 2014-02-19 SWD-20140219103929387 Contents 1... 4 Key features of the Visual Studio plug-in... 4 Get started...5 Request a vendor account... 5 Get code signing and debug token

More information

VICE Catch the hookers! (Plus new rootkit techniques) Jamie Butler Greg Hoglund

VICE Catch the hookers! (Plus new rootkit techniques) Jamie Butler Greg Hoglund VICE Catch the hookers! (Plus new rootkit techniques) Jamie Butler Greg Hoglund Agenda Introduction to Rootkits Where to Hook VICE detection Direct Kernel Object Manipulation (DKOM) No hooking required!

More information

Virtuozzo Virtualization SDK

Virtuozzo Virtualization SDK Virtuozzo Virtualization SDK Programmer's Guide February 18, 2016 Copyright 1999-2016 Parallels IP Holdings GmbH and its affiliates. All rights reserved. Parallels IP Holdings GmbH Vordergasse 59 8200

More information

Process Scheduling. Process Scheduler. Chapter 7. Context Switch. Scheduler. Selection Strategies

Process Scheduling. Process Scheduler. Chapter 7. Context Switch. Scheduler. Selection Strategies Chapter 7 Process Scheduling Process Scheduler Why do we even need to a process scheduler? In simplest form, CPU must be shared by > OS > Application In reality, [multiprogramming] > OS : many separate

More information

Assembly Language: Function Calls" Jennifer Rexford!

Assembly Language: Function Calls Jennifer Rexford! Assembly Language: Function Calls" Jennifer Rexford! 1 Goals of this Lecture" Function call problems:! Calling and returning! Passing parameters! Storing local variables! Handling registers without interference!

More information

MeshBee Open Source ZigBee RF Module CookBook

MeshBee Open Source ZigBee RF Module CookBook MeshBee Open Source ZigBee RF Module CookBook 2014 Seeed Technology Inc. www.seeedstudio.com 1 Doc Version Date Author Remark v0.1 2014/05/07 Created 2 Table of contents Table of contents Chapter 1: Getting

More information

Research and Design of Universal and Open Software Development Platform for Digital Home

Research and Design of Universal and Open Software Development Platform for Digital Home Research and Design of Universal and Open Software Development Platform for Digital Home CaiFeng Cao School of Computer Wuyi University, Jiangmen 529020, China cfcao@126.com Abstract. With the development

More information

Writing a C-based Client/Server

Writing a C-based Client/Server Working the Socket Writing a C-based Client/Server Consider for a moment having the massive power of different computers all simultaneously trying to compute a problem for you -- and still being legal!

More information

Chapter 1 FUNDAMENTALS OF OPERATING SYSTEM

Chapter 1 FUNDAMENTALS OF OPERATING SYSTEM Chapter 1 FUNDAMENTALS OF OPERATING SYSTEM An operating system is a program that acts as an intermediary between a user of a computer and the computer hardware. The purpose of an operating system is to

More information