Kernel Synchronization in Linux Uni-processor and Multi-processor Environment By Kathryn Bean and Wafa’ Jaffal (Group A3)

Slides:



Advertisements
Similar presentations
Symmetric Multiprocessors: Synchronization and Sequential Consistency.
Advertisements

1 Interprocess Communication 1. Ways of passing information 2. Guarded critical activities (e.g. updating shared data) 3. Proper sequencing in case of.
Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community.
Secure Operating Systems Lesson 2: OS Fundamentals.
1 Chapter 5 Concurrency: Mutual Exclusion and Synchronization Principals of Concurrency Mutual Exclusion: Hardware Support Semaphores Readers/Writers Problem.
Global Environment Model. MUTUAL EXCLUSION PROBLEM The operations used by processes to access to common resources (critical sections) must be mutually.
Chapter 6: Process Synchronization
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 6: Process Synchronization.
Process Synchronization. Module 6: Process Synchronization Background The Critical-Section Problem Peterson’s Solution Synchronization Hardware Semaphores.
Kernel Synchronization
Review: Chapters 1 – Chapter 1: OS is a layer between user and hardware to make life easier for user and use hardware efficiently Control program.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
OS Fall ’ 02 Introduction Operating Systems Fall 2002.
CS533 Concepts of Operating Systems Class 4 Linux Kernel Locking Issues.
Chapter 6: Process Synchronization. 6.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 8, 2005 Objectives Understand.
CS510 Concurrent Systems Class 1
02/23/2004CSCI 315 Operating Systems Design1 Process Synchronization Notice: The slides for this lecture have been largely based on those accompanying.
CENG334 Introduction to Operating Systems Erol Sahin Dept of Computer Eng. Middle East Technical University Ankara, TURKEY URL:
Operating Systems CS208. What is Operating System? It is a program. It is the first piece of software to run after the system boots. It coordinates the.
CS510 Concurrent Systems Class 1 Linux Kernel Locking Techniques.
Chapter 6: Synchronization. 6.2 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Module 6: Synchronization 6.1 Background 6.2 The Critical-Section.
CS533 Concepts of Operating Systems Class 17 Linux Kernel Locking Techniques.
Race Conditions CS550 Operating Systems. Review So far, we have discussed Processes and Threads and talked about multithreading and MPI processes by example.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
CS533 Concepts of Operating Systems Linux Kernel Locking Techniques.
Instructor: Umar KalimNUST Institute of Information Technology Operating Systems Process Synchronization.
Operating Systems CSE 411 CPU Management Oct Lecture 13 Instructor: Bhuvan Urgaonkar.
Synchronization and Scheduling in Multiprocessor Operating Systems
Chapter 2 Operating System Overview Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,
Understanding Operating Systems Fifth Edition Chapter 6 Concurrent Processes.
Cosc 4740 Chapter 6, Part 3 Process Synchronization.
Chapter 6 Concurrent Processes Understanding Operating Systems, Fourth Edition.
Concurrency, Mutual Exclusion and Synchronization.
Operating Systems CSE 411 Multi-processor Operating Systems Multi-processor Operating Systems Dec Lecture 30 Instructor: Bhuvan Urgaonkar.
Operating Systems CSE 411 Kernel synchronization, deadlocks Kernel synchronization, deadlocks Dec Lecture 31 Instructor: Bhuvan Urgaonkar.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Mutual Exclusion.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 9 th Edition Chapter 5: Process Synchronization.
Kernel Locking Techniques by Robert Love presented by Scott Price.
Chapter 7 -1 CHAPTER 7 PROCESS SYNCHRONIZATION CGS Operating System Concepts UCF, Spring 2004.
Memory Consistency Models. Outline Review of multi-threaded program execution on uniprocessor Need for memory consistency models Sequential consistency.
Chapter 6: Process Synchronization. 6.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Module 6: Process Synchronization Background The.
CS533 Concepts of Operating Systems Jonathan Walpole.
CS399 New Beginnings Jonathan Walpole. 2 Concurrent Programming & Synchronization Primitives.
BeOS AJ Schuster Robert Robinson Nicole Chung Brian Hoffman.
Amanda Johnson Hannah Young Josh Taylor Rich Carroll Troy Gladhill Saunders Roesser.
1 Lecture 1: Computer System Structures We go over the aspects of computer architecture relevant to OS design  overview  input and output (I/O) organization.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Computer Systems Principles Synchronization Emery Berger and Mark Corner University.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 6: Process Synchronization.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
CSC 660: Advanced Operating SystemsSlide #1 CSC 660: Advanced OS Synchronization.
SMP Basics KeyStone Training Multicore Applications Literature Number: SPRPxxx 1.
Mutual Exclusion -- Addendum. Mutual Exclusion in Critical Sections.
Symmetric Multiprocessors: Synchronization and Sequential Consistency
Sarah Diesburg Operating Systems COP 4610
Chapter 6: Process Synchronization
CS703 – Advanced Operating Systems
Memory Consistency Models
Memory Consistency Models
Chapter 5: Process Synchronization
Symmetric Multiprocessing (SMP)
Symmetric Multiprocessors: Synchronization and Sequential Consistency
Topic 6 (Textbook - Chapter 5) Process Synchronization
Lecture 2 Part 2 Process Synchronization
Concurrency: Mutual Exclusion and Process Synchronization
Chapter 6: Process Synchronization
CS510 Concurrent Systems Class 1a
CS333 Intro to Operating Systems
Chapter 6: Synchronization Tools
CSE 542: Operating Systems
Presentation transcript:

Kernel Synchronization in Linux Uni-processor and Multi-processor Environment By Kathryn Bean and Wafa’ Jaffal (Group A3)

Topics Linux History Kernel Control Path Synchronization Technique SMP Architecture Hardware Support for Synchronization (Pentium-based Architecture) Linux/SMP kernel Conclusion

Linux History University of Helsinki (1997), Master’s thesis – “Linux, a Portable Operating System” by L. Torvalds OS for IBM-compatible personal computers (Intel microprocessor). Source code under GNU General Public License

Kernel Control Path Kernel control path is the sequence of instructions executed in Kernel Mode to handle a kernel request. Kernel control path executes due to the following reasons: – System calls – Exceptions – Interrupts

Synchronization Technique Nonpreemptability Atomic Operations Interrupt Disabling Locks

Condition to be Preempted Kernel control path can preempt a running process; however, when an interrupt handle terminates, the process resumes. Only kernel control path can interrupt another kernel control path.

Atomic Operation An atomic operation - performed by executing a single assembly language instruction Linux kernel provides special functions such as: atomic_int(v)  v++

Interrupt Disabling Because of its simplicity, interrupt disabling is used by kernel functions for implementing a critical region. This technique does not always prevent kernel control path interleaving. Critical section should be short because any communication between CPU and I/O is blocked while a kernel control path is running in this section.

Locking Two kinds of locking: – Kernel semaphores, used by both uni-processor and multiprocessor systems – Spin Locks, used by only multiprocessor systems

Kernel Semaphore Implementation Kernel semaphore – is object of type structure semaphore, see include/asm/semaphore.h file Fields – count – integer number count > 0 – semaphore is available count  0 – semaphore is busy, |count| - number of processes waiting for resource. Count = 0 – one use, nothing is waiting The count field is decremented when a process acquires the lock and is incremented when the same process releases it.

Kernel Semaphore Implementation, Continued – wait – the address of a wait queue. – waking – integer. The releasing process increments waking field(s). Each of awakened process P I then enters a critical region of the down() function Is P I ’s waking <> 0, if waking > 0 – 1. acquire the resource 2. other P K ’s waking-- if waking < 0 – go back to sleep

Kernel Semaphore Implementation, Continued Function – down() – called, if process wishes to acquire a semaphore. count -- count <> 0, if count  0 – process enter the critical section if count < 0 – process is suspended – up() – called, if process releases a semaphore count ++ count <> 0 – if count > 0 – up() terminates if count < 0 – wake up other processes Deadlock – semaphore requests are performed in the address order.

SMP Architecture Scalability of Linux - supports multiprocessing through Shared Memory Symmetric Multiprocessors (SMM) architecture. scalability is the capability of a system to adapt to an ever-increasing work load.

SMP Architecture, Continued system bus CPU 1CPU n Graphical card Memory CPUs share the same memory unit application processing and kernel processing are spread amongst all CPUs.

Other Multiprocessor Architectures Asymmetric Multiprocessing Master CPU executes the operating system code and application programs run on the remaining CPUs. Massively Parallel Processing (MPP) Assemble hundreds or thousand of CPUs, each with own system memory

Hardware Support for Synchronization Shared Memory Memory arbiter – (chip between bus and every RAM chip) grants access to a CPU if the chip is free and delays access if the chip is busy. Cache Synchronization Hardware cache is utilized using the locality principle. In multiprocessor environment, each CPU has its own cache. Process of updating cache - cache snooping

Hardware Support for Synchronization, Continued SMP Atomic Operation – Lock instruction prefixes for atomic operations were introduced. – If control unit detects them  lock the memory bus, no other processes can access this memory location

Hardware Support for Synchronization, Continued Distributed Interrupt Handling ICC bus Local APIC I/O APIC CPU 1CPU n IRQ lines APIC – Advanced Programmable Interrupt Controller ICC – Interrupt Controller Communication I/O APIC - router

Linux/SMP Kernel Process Descriptor Modification – has_cpu: if has_cpu > 0 – process is running – Processor – logical number of its CPU Spin Locks Blocked process keeps its own CPU by spinning while waiting for a resource.

Conclusion Modern versions of Linux are available – Compaq Alpha – SPARC – PowerPC – Motorola MC680x0 – IBM System/390 Multiprocessor operating system Supports up to 32 CPUs

Bibliography D. P. Bovet, M. Cesati. Understanding the Linux Kernel. O’Reilly, 2000 Linus Torvalds. Linux: a Portable Operating System.Master of Science Thesis, University of Helsinki, Finland, 1997 D. Mosberg, S. EranianIA-64 Linux Kernel Prentice Hall PTR, 2002

Thank You Any Questions?