Chapter 3: Windows7 Part 5.

Slides:



Advertisements
Similar presentations
Procesi in niti pri Windows NT. Procesi in niti Primeri sistemskih niti.
Advertisements

Chorus and other Microkernels Presented by: Jonathan Tanner and Brian Doyle Articles By: Jon Udell Peter D. Varhol Dick Pountain.
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
Computer Systems/Operating Systems - Class 8
1 Threads CSCE 351: Operating System Kernels Witawas Srisa-an Chapter 4-5.
INTRODUCTION OS/2 was initially designed to extend the capabilities of DOS by IBM and Microsoft Corporations. To create a single industry-standard operating.
3.5 Interprocess Communication Many operating systems provide mechanisms for interprocess communication (IPC) –Processes must communicate with one another.
Concurrency: Mutual Exclusion, Synchronization, Deadlock, and Starvation in Representative Operating Systems.
3.5 Interprocess Communication
Process Management. External View of the OS Hardware fork() CreateProcess() CreateThread() close() CloseHandle() sleep() semctl() signal() SetWaitableTimer()
CSS430 Case Study (Win XP) These slides were prepared by Professor Kelvin Sung based on the Applied OSC textbook slides (Silberschatz, Galvin, and Gagne).
Introduction to NT Operating system
Chapter 6 Implementing Processes, Threads, and Resources.
Slide 6-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 6.
1 Threads Chapter 4 Reading: 4.1,4.4, Process Characteristics l Unit of resource ownership - process is allocated: n a virtual address space to.
Chapter 51 Threads Chapter 5. 2 Process Characteristics  Concept of Process has two facets.  A Process is: A Unit of resource ownership:  a virtual.
Slide 6-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 6.
Chapter 8 Windows Outline Programming Windows 2000 System structure Processes and threads in Windows 2000 Memory management The Windows 2000 file.
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,
1 Lecture 4: Threads Operating System Fall Contents Overview: Processes & Threads Benefits of Threads Thread State and Operations User Thread.
Page 110/1/2015 CSE 30341: Operating Systems Principles Windows XP  32-bit preemptive multitasking operating system for Intel microprocessors  Key goals.
Windows NT 32-bit preemptive multitasking operating system for modern microprocessors. Key goals for the system: –Portability –Security –POSIX compliance.
Windows 2000 Course Summary Computing Department, Lancaster University, UK.
Processes and Threads Processes have two characteristics: – Resource ownership - process includes a virtual address space to hold the process image – Scheduling/execution.
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
Threads G.Anuradha (Reference : William Stallings)
CS533 - Concepts of Operating Systems 1 The Mach System Presented by Catherine Vilhauer.
System Components ● There are three main protected modules of the System  The Hardware Abstraction Layer ● A virtual machine to configure all devices.
M. Accetta, R. Baron, W. Bolosky, D. Golub, R. Rashid, A. Tevanian, and M. Young MACH: A New Kernel Foundation for UNIX Development Presenter: Wei-Lwun.
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
CSE 153 Design of Operating Systems Winter 2015 Midterm Review.
CSCI/CMPE 4334 Operating Systems Review: Exam 1 1.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
Appendix C: Windows 2000.
Processes and threads.
Applied Operating System Concepts
Process concept.
The Mach System Sri Ramkrishna.
Day 12 Threads.
Process Management Presented By Aditya Gupta Assistant Professor
Chapter 4 Threads.
Operating Systems: A Modern Perspective, Chapter 6
Lecture 6 : Windows7.
KERNEL ARCHITECTURE.
Threads and Locks.
Chapter 3: Windows7 Part 1.
Chapter 3: Windows7 Part 2.
Chapter 3: Windows7 Part 5.
Chapter 4: Threads.
Threads, SMP, and Microkernels
Threads and Data Sharing
Chapter 2: System Structures
Chapter 3: Windows7 Part 2.
Lecture 4- Threads, SMP, and Microkernels
Threads and Concurrency
Threads Chapter 4.
CHAPTER 4:THreads Bashair Al-harthi OPERATING SYSTEM
Chapter 2: The Linux System Part 5
Concurrency, Processes and Threads
Operating Systems: A Modern Perspective, Chapter 3
Chapter 3: Processes.
Chapter 4: Threads & Concurrency
Chapter 4: Threads.
Chapter 16: Windows 7.
Operating Systems: A Modern Perspective, Chapter 6
Implementing Processes, Threads, and Resources
Windows NT History Design Principles System Components
Outline Operating System Organization Operating System Examples
CSE 153 Design of Operating Systems Winter 2019
Appendix C: Windows 2000.
Presentation transcript:

Chapter 3: Windows7 Part 5

Chapter 3: Windows7 History Design Principles System Components Environmental Subsystems File system Networking Programmer Interface

Programmer Interface

Programmer Interface — Access to Kernel Objects TheWin32 API is the fundamental interface to the capabilities of Windows. This section describes five main aspects of the Win32 API: access to kernel objects sharing of objects between processes process management interprocess communication memory management.

Programmer Interface — Access to Kernel Objects The Windows kernel provides many services that application programs can use. Application programs obtain these services by manipulating kernel objects. A process gains access to a kernel object named XXX by calling the CreateXXX function to open a handle to XXX; the handle is unique to that process. A handle can be closed by calling the CloseHandle function; the system may delete the object if the count of processes using the object drops to 0.

Programmer Interface — share objects between processes Windows provides three ways to share objects between processes A child process inherits a handle to the object One process gives the object a name when it is created and the second process opens that name DuplicateHandle function: Given a handle to process and the handle’s value a second process can get a handle to the same object, and thus share it

Programmer Interface — Process Management Process is started via the CreateProcess routine which loads any dynamic link libraries that are used by the process, and creates a primary thread. Additional threads can be created by the CreateThread function. Every dynamic link library or executable file that is loaded into the address space of a process is identified by an instance handle.

Thread Scheduling Scheduling in Windows utilizes four priority classes: IDLE_PRIORITY_CLASS (priority level 4) NORMAL_PRIORITY_CLASS (level 8 — typical for most processes HIGH_PRIORITY_CLASS (level 13) REALTIME_PRIORITY_CLASS (level 24) The process contains the default priority classes for its threads, but each thread can vary its own priority that is used for actual scheduling. To provide performance levels needed for interactive programs, Windows has a special scheduling rule for processes in the NORMAL_PRIORITY_CLASS Windows distinguishes between the foreground process that is currently selected on the screen, and the background processes that are not currently selected. When a process moves to foreground, Windows increases boosts it’s thread’s priorities and increments the scheduling quantum.

Thread Scheduling (Cont.) The kernel dynamically adjusts the priority of a thread depending on whether it is I/O-bound or CPU-bound I/O-bound threads have their priority boosted as long as they do not run to the end of their scheduling quantum. To synchronize the concurrent access to shared objects by threads, the kernel provides synchronization objects, such as semaphores and mutexes for synchronizing threads in different processes In addition, threads can synchronize with kernel operations using the WaitForSingleObject or WaitForMultipleObjects APIs. Synchronization between threads within a process uses Win32 APIs for critical sections, SRW (Simple Reader/Writer) Locks, Lockfree LIFO lists, and condition variables.

Thread Scheduling (Cont.) A fiber is user-mode code that gets scheduled according to a user-defined scheduling algorithm. Windows includes fibers to facilitate the porting of legacy UNIX applications that are written for a fiber execution model. Fibers are implemented purely in user mode by multiplexing the fibers onto true Windows threads. User Mode Scheduling was introduced into Windows 7 to provide support for the Visual Studio 2010 Concurrency RunTime (ConcRT) UMS allows the user portion of a Windows thread to block in user-mode and the CPU to be switched to another user-mode thread without having to enter protected mode. When the kernel portion of a Windows thread blocks in the OS, the CPU is returned to the user-mode scheduler for re-use. When system calls complete, the user-mode scheduler is notified so it can again schedule the blocked thread for execution.

User Mode Scheduling (UMS) NTOS executive KT0 blocks KT0 KT1 KT2 Primary Thread trap code Thread Parking kernel user UT Completion list UT0 User-mode Scheduler Only primary thread runs in user-mode Trap code switches to parked KT KT blocks  primary returns to user-mode KT unblocks & parks  queue UT completion UT0 UT1

Programmer Interface — Interprocess Communication Win32 applications can have interprocess communication by sharing kernel objects, including shared memory sections and files. An alternate means of interprocess communications is message passing, which is particularly popular for Windows GUI applications One thread sends a message to another thread or to a window. A thread can also send data with the message. Every Win32 thread has its own input queue from which the thread receives messages.

Programmer Interface — Memory Management Virtual memory: VirtualAlloc reserves or commits virtual memory VirtualFree decommits or releases the memory These functions enable the application to determine the virtual address at which the memory is allocated An application can use memory by memory mapping a file into its address space Multistage process Two processes share memory by mapping the same file into their virtual memory

Memory Management (Cont.) A heap in the Win32 environment is a region of reserved address space A Win 32 process is created with a 1 MB default heap Access is synchronized to protect the heap’s space allocation data structures from damage by concurrent updates by multiple threads Because functions that rely on global or static data typically fail to work properly in a multithreaded environment, the thread-local storage mechanism allocates global storage on a per-thread basis The mechanism provides both dynamic and static methods of creating thread-local storage