NT Executive Resources

Slides:



Advertisements
Similar presentations
Operating Systems Semaphores II
Advertisements

Ch 7 B.
Chapter 6: Process Synchronization
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 6: Process Synchronization.
Bilgisayar Mühendisliği Bölümü GYTE - Bilgisayar Mühendisliği Bölümü Multithreading the SunOS Kernel J. R. Eykholt, S. R. Kleiman, S. Barton, R. Faulkner,
5.6 Semaphores Semaphores –Software construct that can be used to enforce mutual exclusion –Contains a protected variable Can be accessed only via wait.
CS533 Concepts of Operating Systems Class 4 Linux Kernel Locking Issues.
Files. System Calls for File System Accessing files –Open, read, write, lseek, close Creating files –Create, mknod.
5.6.2 Thread Synchronization with Semaphores Semaphores can be used to notify other threads that events have occurred –Producer-consumer relationship Producer.
Inter Process Communication:  It is an essential aspect of process management. By allowing processes to communicate with each other: 1.We can synchronize.
Concurrency: Mutual Exclusion, Synchronization, Deadlock, and Starvation in Representative Operating Systems.
1 Concurrency: Deadlock and Starvation Chapter 6.
Race Conditions CS550 Operating Systems. Review So far, we have discussed Processes and Threads and talked about multithreading and MPI processes by example.
1 I/O Management in Representative Operating Systems.
Using Two Queues. Using Multiple Queues Suspended Processes Processor is faster than I/O so all processes could be waiting for I/O Processor is faster.
Instructor: Umar KalimNUST Institute of Information Technology Operating Systems Process Synchronization.
File System. NET+OS 6 File System Architecture Design Goals File System Layer Design Storage Services Layer Design RAM Services Layer Design Flash Services.
MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 11 Case Study 2: Windows Vista Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
LAB 11: Task Synchronization Chung-Ta King National Tsing Hua University CS 4101 Introduction to Embedded Systems.
Palm OS Jeremy Etzkorn Paul Rutschky Adam Lee Amit Bhatia Tony Picarazzi.
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
The HDF Group Multi-threading in HDF5: Paths Forward Current implementation - Future directions May 30-31, 2012HDF5 Workshop at PSI 1.
CSE451 NT Synchronization Autumn 2002 Gary Kimura Lecture #9 October 18, 2002.
Race condition The scourge of parallel and distributed computing...
CSE 451: Operating Systems Section 5 Midterm review.
Kernel Locking Techniques by Robert Love presented by Scott Price.
Monitors and Blocking Synchronization Dalia Cohn Alperovich Based on “The Art of Multiprocessor Programming” by Herlihy & Shavit, chapter 8.
CSE 451: Operating Systems Section 5 Synchronization.
Amanda Johnson Hannah Young Josh Taylor Rich Carroll Troy Gladhill Saunders Roesser.
Windows CE Portable Modular Real-time Small footprint Embedded market.
CSC 660: Advanced Operating SystemsSlide #1 CSC 660: Advanced OS Synchronization.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 6: Process Synchronization.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 5: Process Synchronization.
Mutual Exclusion -- Addendum. Mutual Exclusion in Critical Sections.
Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D.
6.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles 6.5 Semaphore Less complicated than the hardware-based solutions Semaphore S – integer.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
Chapter 6: Process Synchronization
Background on the need for Synchronization
Chapter 11: File System Implementation
CSE451 I/O Systems and the Full I/O Path Autumn 2002
Semaphores and Condition Variables
Chapter 5: Process Synchronization
CSE451 Basic Synchronization Spring 2001
Threads and Locks.
Concurrency: Mutual Exclusion and Synchronization
Chapter 11: File-System Interface
Monitors Chapter 7.
Chapter 11: File System Implementation
Threading And Parallel Programming Constructs
Semaphore Originally called P() and V() wait (S) { while S <= 0
Process Synchronization
Lecture Topics: 11/1 General Operating System Concepts Processes
Lecture 2 Part 2 Process Synchronization
Another Means Of Thread Synchronization
Monitors Chapter 7.
Concurrency: Mutual Exclusion and Process Synchronization
NT Synchronization Primitives
Monitors Chapter 7.
Thread Synchronization including Mutual Exclusion
CSE 153 Design of Operating Systems Winter 19
Chapter 11: File System Implementation
Chapter 6: Synchronization Tools
System Calls System calls are the user API to the OS
CSE 451 Section 1/27/2000.
Internal Representation of Files
Lecture 4: File-System Interface
EECE.4810/EECE.5730 Operating Systems
Mr. M. D. Jamadar Assistant Professor
CSE 542: Operating Systems
Presentation transcript:

NT Executive Resources April 24, 2000 Instructor: Gary Kimura 1

NT Resource The NT Resource module is a general purpose shared/exclusive access control package. It is callable from all kernel mode code It is used in the file systems to control access to common data structures and files It is used in the cache manager to represent shared and exclusive access to cached sections It is used in device drivers A version was even ported to user mode

Basic Features The package uses Thread based ownership. Meaning a thread is the indivisible entity that can acquire and release access to a Resource There can be multiple readers (i.e., shared access) There can be a single writer (i.e., exclusive access) Special code is added to prevent or even promote starvation Recursive acquisition is allowed A thread can even acquire and maintain ownership across kernel calls The package guards against priority inversion

Overall design Basically the Resource is an ADT with the following API ExInitializeResource( Resource ) ExAcquireResourceShared( Resource, Wait ) ExAcquireResourceSharedStarveExclusive( Resource, Wait ) ExAcquireResourceExclusive( Resource, Wait ) ExReleaseResource( Resource ) ExConvertExclusiveToShared( Resource ) ExDeleteResource( Resource ) Global debug support is built into the package Global list of all resources in the system

Resource Data Fields Each Resource contains the following data fields: SpinLock – Controls access to the data fields SystemResourcesList – Global list of resources ActiveCount – Number of threads that own this resource Flags – State bits for the resource (owned exclusive, etc) OwnerTable – Pointer to an ownership table array OwnerThreads[2] – An allocation optimization for with at most two owners

Resource Data Fields (continued) SharedWaiters – A semaphore for threads waiting for shared access to the resource ExclusiveWaiters – A synchronization event for threads waiting for exclusive access to the resource NumberOfSharedWaiters – Current number of shared waiters NumberOfExclusiveWaiters – Current number of exclusive waiters ContentionCount – Number of times a thread has had to wait for this resource

Notes Global data for resources Owner table Global spinlock – Used for getting access to the global resource list Global list head – Used to link all of the resources in the system into a common list Owner table Each table entry contains a thread id and a thread ownership count The table can dynamically grow as resource usage increases Exclusive ownership is stored in OwnerTable[0]

Acquire Resource Exclusive Logic Acquire resource spinlock if the resource is available (i.e., Active count == 0) then Set current thread as the exclusive resource owner Set ActiveCount = 1 Release resource spinlock else if the resource is held exclusive by the current thread then Increment Thread Ownership count else if we can wait for the resource then Increment NumberOfExclusiveWaiters Wait on the ExclusiveWaiters event return

Acquire Resource Shared Logic If Resource is available Set current thread in OwnerTable; Set ActiveCount = 1; return; If Resource is held exclusive If current thread already has the resource Increment Thread Ownership count; If current thread does not have the resource Add current thread to OwnerTable; Wait on SharedWaiter semaphore;

Acquire Resource Shared Logic (Continued) Resource is already shared If current thread already has the resource Increment Thread Ownership count; return; If current thread does not have the resource If there are exclusive waiters Add current thread to the OwnerTable; Wait on the SharedWaiters semaphore; If there are no exclusive waiters

Release Resource Logic If resource is held exclusive Decrement Thread Ownership count; If thread ownership count is now zero If there are threads waiting for shared access Set resource for shared access; Signal SharedWaiters by number of shared waiters; return; If there are threads waiting for exclusive access Signal ExclusiveWaiters;

Release Resource Logic (continued) If resource is held shared Locate and decrement Thread Ownership count; If thread ownership count is now zero Decrement ActiveCount; If ActiveCount is now zero If there are threads waiting for exclusive access Set resource to look like it is held exclusive; Signal ExclusiveWaiters; return;