SlideShare a Scribd company logo
Presented by : Parth Desai
 Introduction to Windows Kernel
 Helper modules of Windows Kernel
 Process Threads and Jobs
 Virtual Memory Management in Windows
 Conclusion
 In the Windows operating system, an object is a single, run-time instance of a statically
defined object type.
 An object type comprises a system-defined data type, functions that operate on instances
of the data type, and a set of object attributes.
 These objects are based on lower-level objects that Windows creates and manages.
 In Windows, a process is an instance of the process object type, a file is an instance of
the file object type, and so on.
 An object attribute is a field of data in an object that partially defines the object’s
state.
 Object methods, the means for manipulating objects, usually read or change the
object attributes.
 For example, the open method for a process would accept a process identifier as
input and return a pointer to the object as output.
 Windows kernel is the core part of Windows Operating System. It is monolithic kernel
and contained in (%SystemDir%System32ntoskrnl.exe).
 Windows Kernel provides service routines and helper functions to access system
resources and Hardware of Computer.
 For example An application might want to read certain data from the File.
 There is ReadFile Application Programming Interface exported by Kernel32.dll.
 When Application call that function then Windows executes this call as follows:
 First , Control transferred to the ReadFile Api’s code contained in Kernel32.dll.
 The code contained in Kernel32.dll now performs initial checking of its parameters.
 For reference the definition of ReadFile api in msdn is as follows:
• BOOL WINAPI ReadFile(
• __in HANDLE hFile,
• __out LPVOID lpBuffer,
• __in DWORD nNumberOfBytesToRead, _
• _out_opt LPDWORD lpNumberOfBytesRead,
• __inout_opt LPOVERLAPPED lpOverlapped
);
 If the parameter seems to be valid at That time. ReadFile api call now NtReadFile
function contained in Ntdll.dll.
 Ntdll.dll is entry point to Kernel executive’s services. It now performs more accurate
validation of The parameters And then enters into Kernel mode (in ring 0 ). For Intel
processors it execute SYSENTER instruction to enter into Kernel mode.
 Then Kernel dispatch this system call to appropriate service routine.
 As you have seen in ReadFile Api the first parameter of it is “HANDLE hFile” , is
analogues to the object reference.
 You can get this reference by the Api that responsible for creating Object.
 Kernel defines the basic functions and Object for that and taking it as base The upper
layer executive defines more concrete object like file , registry key etc , that comprises
of one or more kernel’s primitive object.
 That routine then finds appropriate device driver to Handle the request.
 The device driver than call the routines in Kernel and Hardware Abstraction
Layer(HAL) to Perform the actual reading.
 The data transferred to the buffer provided by the application in lpBuffer parameter.
 Though Windows is not strict Object Oriented Operating system . Almost every
resource have its Wrapper object and functions that access or properly manipulate the
resources.
 There are main three helper modules that provide functionality additional than core
services. these modules and Windows Kernels are dependent on each others. HAL.DLL
 The hardware abstraction layer (HAL) is a key part of making this portability possible.
 The HAL is a loadable kernel-mode module (Hal.dll) that provides the low-level interface
to the hardware platform on which Windows is running. It hides hardware-dependent details
such as I/O interfaces, interrupt controllers, and multiprocessor communication mechanisms
—any functions that are both architecture-specific and machine-dependent.
 So rather than access hardware directly, Windows internal components as well as user-
written device drivers maintain portability by calling the HAL routines when they need
platform dependent information.
 For this reason, the HAL routines are documented in the WDK. To find out more about the
HAL and its use by device drivers, refer to the WDK. Win32k.sys
 The kernel mode driver (Win32K.sys) contains:
 The window manager, which controls window displays; manages screen output; collects
input from keyboard, mouse, and other devices; and passes user messages to
applications.
 The Graphics Device Interface (GDI), which is a library of functions for graphics output
devices.
 It includes functions for line, text, and figure drawing and for graphics manipulation.
 Wrappers for DirectX support that is implemented in another kernel driver
(Dxgkrnl.sys).
 Kernel Executive (Upper Layer Of Kernel) :
 Kernel leaves almost all possible policy making on Executive. Executive create and
manipulate objects that comprises of one or more Kernel’s primitive objects.
 The Windows executive is the upper layer of Ntoskrnl.exe. (The kernel is the lower
layer.)
 The executive includes the following types of functions:
 Functions that are exported and callable from user mode. These functions are called
system services and are exported via Ntdll.Dll Most of the services are accessible
through the Windows API or the APIs of another environment subsystem.
 A few services, however , are not available through any documented subsystem
function. (Examples include LPCs and various query functions such as
NtQueryInformationProcess, specialized functions such as NtCreatePagingFile, and
so on.)
 Device driver functions that are called through the use of the DeviceIoControl function.
 This provides a general interface from user mode to kernel mode to call functions in
device drivers that are not associated with a read or write.
 Functions that can be called only from kernel mode that are exported and are
documented in the WDK.
 Functions that are exported and callable from kernel mode but are not documented in the
WDK (such as the functions called by the boot video driver, which start with Inbv).
 The process and thread manager creates and terminates processes and threads. The
underlying support for processes and threads is implemented in the Windows kernel; the
executive adds additional semantics and functions to these lower-level objects.
 The memory manager implements virtual memory, a memory management scheme that
provides a large, private address space for each process.
 That can exceed available physical memory. The memory manager also provides the
underlying support for the cache manager.
 The kernel consists of a set of functions in Ntoskrnl.exe that provide fundamental
mechanisms (such as thread scheduling and synchronization services) used by the
executive components , as well as low-level hardware architecture–dependent support
(such as interrupt and exception dispatching), that is different on each processor
architecture.
 The kernel code is written primarily in C, with assembly code reserved for those tasks
that require access to specialized processor instructions and registers not easily
accessible from C.
 Processes and Threads in Kernel are implemented as an Object.
 In Windows Process is just acts as a container for Threads. That means in Windows Only
threads are schedulable Object.
 Windows Kernel exposes Process creation and Thread creation facility by
ZwCreateProcess and ZwCreateThread.
 In Windows context switching occurs When the Application in Windows transit from
User Mode to Kernel Mode and Scheduler detects that the time quantum of Thread has
been expired , or Application waits for some event to be happen.
 In both the cases , Scheduler then tries to search the another Thread that is schedulable
and Start it.
 Windows scheduler supports both Thread Relative Priority levels and Process Priority.
 Process Priority are Low , Below Normal, Normal , Normal , Above Normal , High ,and
Realtime .
 Whereas Thread Priority levels are 0 to 31 in Windows. That are called Relative Thread
Priority Levels because How Windows scheduler interprets them depends on
corresponding Process ‘ s Priority .
 Every Thread or Process has one Id associated with it . This id is unique throughout the
system . And processes and Threads in Windows shares same namespace for ids.
 The api for setting Threads or processes priority is SetProcessPriority and
SetThreadPriority.
 IN Windows Every Application that runs in User Mode has been provided 4 GB of
virtual Memory space for its Data and code.
 Although , The Actual Memory space that can be used by Windows Application is the
Lower half of this address space (x00000000 through x7FFFFFFF) and the upper half is
used by Kernel or its Helper modules (x80000000 through xFFFFFFFF ).
 The mappings of the lower half change to reflect the virtual address space of the
currently executing process.
 But the mappings of the upper half always consist of the operating system’s virtual
memory.
 Because Every process has its own private address space . Then two application can’t
access each other’s data or code without proper sharing.
 Starting From Windows vista and Windows server 2008 the user can enable or set
increaseuserva flag at boot time. Because of this the application that have special flag set
in Their Header can have 3 gb of address space. So, The application can allocate or
commit more memory than the regular application.
THE END

More Related Content

What's hot

Kernel module in linux os.
Kernel module in linux os.Kernel module in linux os.
Kernel module in linux os.
MUKESH BADIGINENI
 
Unix Memory Management - Operating Systems
Unix Memory Management - Operating SystemsUnix Memory Management - Operating Systems
Unix Memory Management - Operating Systems
Drishti Bhalla
 
Linux Directory Structure
Linux Directory StructureLinux Directory Structure
Linux Directory Structure
Kevin OBrien
 
What is Kernel, basic idea of kernel
What is Kernel, basic idea of kernelWhat is Kernel, basic idea of kernel
What is Kernel, basic idea of kernel
Neel Parikh
 
Making Linux do Hard Real-time
Making Linux do Hard Real-timeMaking Linux do Hard Real-time
Making Linux do Hard Real-time
National Cheng Kung University
 
Tuning systemd for embedded
Tuning systemd for embeddedTuning systemd for embedded
Tuning systemd for embedded
Alison Chaiken
 
Linux kernel architecture
Linux kernel architectureLinux kernel architecture
Linux kernel architecture
Teja Bheemanapally
 
4. linux file systems
4. linux file systems4. linux file systems
4. linux file systems
Marian Marinov
 
Operating System-Threads-Galvin
Operating System-Threads-GalvinOperating System-Threads-Galvin
Operating System-Threads-Galvin
Sonali Chauhan
 
Browsing Linux Kernel Source
Browsing Linux Kernel SourceBrowsing Linux Kernel Source
Browsing Linux Kernel Source
Motaz Saad
 
Threads .ppt
Threads .pptThreads .ppt
Threads .ppt
meet darji
 
Linux kernel
Linux kernelLinux kernel
Linux kernel
Goutam Sahoo
 
LCE13: Android Graphics Upstreaming
LCE13: Android Graphics UpstreamingLCE13: Android Graphics Upstreaming
LCE13: Android Graphics Upstreaming
Linaro
 
Window scheduling algorithm
Window scheduling algorithmWindow scheduling algorithm
Window scheduling algorithm
Binal Parekh
 
semaphore & mutex.pdf
semaphore & mutex.pdfsemaphore & mutex.pdf
semaphore & mutex.pdf
Adrian Huang
 
Windows OS Architecture in Summery
Windows OS Architecture in SummeryWindows OS Architecture in Summery
Windows OS Architecture in Summery
Asanka Dilruk
 
Threads (operating System)
Threads (operating System)Threads (operating System)
Threads (operating System)
Prakhar Maurya
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
Manav Prasad
 
Linux File System
Linux File SystemLinux File System
Linux File System
Anil Kumar Pugalia
 
Presentation on Operating System & its Components
Presentation on Operating System & its ComponentsPresentation on Operating System & its Components
Presentation on Operating System & its Components
Mahmuda Rahman
 

What's hot (20)

Kernel module in linux os.
Kernel module in linux os.Kernel module in linux os.
Kernel module in linux os.
 
Unix Memory Management - Operating Systems
Unix Memory Management - Operating SystemsUnix Memory Management - Operating Systems
Unix Memory Management - Operating Systems
 
Linux Directory Structure
Linux Directory StructureLinux Directory Structure
Linux Directory Structure
 
What is Kernel, basic idea of kernel
What is Kernel, basic idea of kernelWhat is Kernel, basic idea of kernel
What is Kernel, basic idea of kernel
 
Making Linux do Hard Real-time
Making Linux do Hard Real-timeMaking Linux do Hard Real-time
Making Linux do Hard Real-time
 
Tuning systemd for embedded
Tuning systemd for embeddedTuning systemd for embedded
Tuning systemd for embedded
 
Linux kernel architecture
Linux kernel architectureLinux kernel architecture
Linux kernel architecture
 
4. linux file systems
4. linux file systems4. linux file systems
4. linux file systems
 
Operating System-Threads-Galvin
Operating System-Threads-GalvinOperating System-Threads-Galvin
Operating System-Threads-Galvin
 
Browsing Linux Kernel Source
Browsing Linux Kernel SourceBrowsing Linux Kernel Source
Browsing Linux Kernel Source
 
Threads .ppt
Threads .pptThreads .ppt
Threads .ppt
 
Linux kernel
Linux kernelLinux kernel
Linux kernel
 
LCE13: Android Graphics Upstreaming
LCE13: Android Graphics UpstreamingLCE13: Android Graphics Upstreaming
LCE13: Android Graphics Upstreaming
 
Window scheduling algorithm
Window scheduling algorithmWindow scheduling algorithm
Window scheduling algorithm
 
semaphore & mutex.pdf
semaphore & mutex.pdfsemaphore & mutex.pdf
semaphore & mutex.pdf
 
Windows OS Architecture in Summery
Windows OS Architecture in SummeryWindows OS Architecture in Summery
Windows OS Architecture in Summery
 
Threads (operating System)
Threads (operating System)Threads (operating System)
Threads (operating System)
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 
Linux File System
Linux File SystemLinux File System
Linux File System
 
Presentation on Operating System & its Components
Presentation on Operating System & its ComponentsPresentation on Operating System & its Components
Presentation on Operating System & its Components
 

Similar to Windows Kernel-

Solid-State diskA solid-state drive also known as a solid-state di.pdf
Solid-State diskA solid-state drive also known as a solid-state di.pdfSolid-State diskA solid-state drive also known as a solid-state di.pdf
Solid-State diskA solid-state drive also known as a solid-state di.pdf
saahinmanpam
 
Linux internal
Linux internalLinux internal
Linux internal
mcganesh
 
Linux architecture
Linux architectureLinux architecture
Linux architecture
mcganesh
 
Windows Architecture Explained by Stacksol
Windows Architecture Explained by StacksolWindows Architecture Explained by Stacksol
Windows Architecture Explained by Stacksol
Stacksol
 
Windows internals
Windows internalsWindows internals
Windows internals
Piyush Jain
 
Driver Programming Report
Driver Programming ReportDriver Programming Report
Driver Programming Report
Shivek Khurana
 
brief intro to Linux device drivers
brief intro to Linux device driversbrief intro to Linux device drivers
brief intro to Linux device drivers
Alexandre Moreno
 
UNIT II.pptx
UNIT II.pptxUNIT II.pptx
UNIT II.pptx
YogapriyaJ1
 
Case Study 2: WINDOWS VISTA
Case Study 2: WINDOWS VISTACase Study 2: WINDOWS VISTA
Case Study 2: WINDOWS VISTA
Munazza-Mah-Jabeen
 
Operating system ppt
Operating system pptOperating system ppt
Operating system ppt
kaviya kumaresan
 
Operating system ppt
Operating system pptOperating system ppt
Operating system ppt
kaviya kumaresan
 
Operating system ppt
Operating system pptOperating system ppt
Operating system ppt
kaviya kumaresan
 
Operating system ppt
Operating system pptOperating system ppt
Operating system ppt
kaviya kumaresan
 
Os
OsOs
Os
OsOs
Device Drivers
Device DriversDevice Drivers
Device Drivers
Kushal Modi
 
Operating system
Operating systemOperating system
Operating system
Kinza Razzaq
 
LINUX Device Drivers
LINUX Device DriversLINUX Device Drivers
LINUX Device Drivers
Partha Bhattacharya
 
Chapter 22 - Windows XP
Chapter 22 - Windows XPChapter 22 - Windows XP
Chapter 22 - Windows XP
Wayne Jones Jnr
 
Unix1
Unix1Unix1

Similar to Windows Kernel- (20)

Solid-State diskA solid-state drive also known as a solid-state di.pdf
Solid-State diskA solid-state drive also known as a solid-state di.pdfSolid-State diskA solid-state drive also known as a solid-state di.pdf
Solid-State diskA solid-state drive also known as a solid-state di.pdf
 
Linux internal
Linux internalLinux internal
Linux internal
 
Linux architecture
Linux architectureLinux architecture
Linux architecture
 
Windows Architecture Explained by Stacksol
Windows Architecture Explained by StacksolWindows Architecture Explained by Stacksol
Windows Architecture Explained by Stacksol
 
Windows internals
Windows internalsWindows internals
Windows internals
 
Driver Programming Report
Driver Programming ReportDriver Programming Report
Driver Programming Report
 
brief intro to Linux device drivers
brief intro to Linux device driversbrief intro to Linux device drivers
brief intro to Linux device drivers
 
UNIT II.pptx
UNIT II.pptxUNIT II.pptx
UNIT II.pptx
 
Case Study 2: WINDOWS VISTA
Case Study 2: WINDOWS VISTACase Study 2: WINDOWS VISTA
Case Study 2: WINDOWS VISTA
 
Operating system ppt
Operating system pptOperating system ppt
Operating system ppt
 
Operating system ppt
Operating system pptOperating system ppt
Operating system ppt
 
Operating system ppt
Operating system pptOperating system ppt
Operating system ppt
 
Operating system ppt
Operating system pptOperating system ppt
Operating system ppt
 
Os
OsOs
Os
 
Os
OsOs
Os
 
Device Drivers
Device DriversDevice Drivers
Device Drivers
 
Operating system
Operating systemOperating system
Operating system
 
LINUX Device Drivers
LINUX Device DriversLINUX Device Drivers
LINUX Device Drivers
 
Chapter 22 - Windows XP
Chapter 22 - Windows XPChapter 22 - Windows XP
Chapter 22 - Windows XP
 
Unix1
Unix1Unix1
Unix1
 

Windows Kernel-

  • 1. Presented by : Parth Desai
  • 2.  Introduction to Windows Kernel  Helper modules of Windows Kernel  Process Threads and Jobs  Virtual Memory Management in Windows  Conclusion
  • 3.  In the Windows operating system, an object is a single, run-time instance of a statically defined object type.  An object type comprises a system-defined data type, functions that operate on instances of the data type, and a set of object attributes.  These objects are based on lower-level objects that Windows creates and manages.  In Windows, a process is an instance of the process object type, a file is an instance of the file object type, and so on.
  • 4.  An object attribute is a field of data in an object that partially defines the object’s state.  Object methods, the means for manipulating objects, usually read or change the object attributes.  For example, the open method for a process would accept a process identifier as input and return a pointer to the object as output.
  • 5.  Windows kernel is the core part of Windows Operating System. It is monolithic kernel and contained in (%SystemDir%System32ntoskrnl.exe).  Windows Kernel provides service routines and helper functions to access system resources and Hardware of Computer.  For example An application might want to read certain data from the File.  There is ReadFile Application Programming Interface exported by Kernel32.dll.  When Application call that function then Windows executes this call as follows:  First , Control transferred to the ReadFile Api’s code contained in Kernel32.dll.  The code contained in Kernel32.dll now performs initial checking of its parameters.
  • 6.  For reference the definition of ReadFile api in msdn is as follows: • BOOL WINAPI ReadFile( • __in HANDLE hFile, • __out LPVOID lpBuffer, • __in DWORD nNumberOfBytesToRead, _ • _out_opt LPDWORD lpNumberOfBytesRead, • __inout_opt LPOVERLAPPED lpOverlapped );  If the parameter seems to be valid at That time. ReadFile api call now NtReadFile function contained in Ntdll.dll.  Ntdll.dll is entry point to Kernel executive’s services. It now performs more accurate validation of The parameters And then enters into Kernel mode (in ring 0 ). For Intel processors it execute SYSENTER instruction to enter into Kernel mode.  Then Kernel dispatch this system call to appropriate service routine.
  • 7.  As you have seen in ReadFile Api the first parameter of it is “HANDLE hFile” , is analogues to the object reference.  You can get this reference by the Api that responsible for creating Object.  Kernel defines the basic functions and Object for that and taking it as base The upper layer executive defines more concrete object like file , registry key etc , that comprises of one or more kernel’s primitive object.  That routine then finds appropriate device driver to Handle the request.  The device driver than call the routines in Kernel and Hardware Abstraction Layer(HAL) to Perform the actual reading.  The data transferred to the buffer provided by the application in lpBuffer parameter.  Though Windows is not strict Object Oriented Operating system . Almost every resource have its Wrapper object and functions that access or properly manipulate the resources.
  • 8.
  • 9.  There are main three helper modules that provide functionality additional than core services. these modules and Windows Kernels are dependent on each others. HAL.DLL  The hardware abstraction layer (HAL) is a key part of making this portability possible.  The HAL is a loadable kernel-mode module (Hal.dll) that provides the low-level interface to the hardware platform on which Windows is running. It hides hardware-dependent details such as I/O interfaces, interrupt controllers, and multiprocessor communication mechanisms —any functions that are both architecture-specific and machine-dependent.  So rather than access hardware directly, Windows internal components as well as user- written device drivers maintain portability by calling the HAL routines when they need platform dependent information.  For this reason, the HAL routines are documented in the WDK. To find out more about the HAL and its use by device drivers, refer to the WDK. Win32k.sys
  • 10.  The kernel mode driver (Win32K.sys) contains:  The window manager, which controls window displays; manages screen output; collects input from keyboard, mouse, and other devices; and passes user messages to applications.  The Graphics Device Interface (GDI), which is a library of functions for graphics output devices.  It includes functions for line, text, and figure drawing and for graphics manipulation.  Wrappers for DirectX support that is implemented in another kernel driver (Dxgkrnl.sys).
  • 11.  Kernel Executive (Upper Layer Of Kernel) :  Kernel leaves almost all possible policy making on Executive. Executive create and manipulate objects that comprises of one or more Kernel’s primitive objects.  The Windows executive is the upper layer of Ntoskrnl.exe. (The kernel is the lower layer.)  The executive includes the following types of functions:  Functions that are exported and callable from user mode. These functions are called system services and are exported via Ntdll.Dll Most of the services are accessible through the Windows API or the APIs of another environment subsystem.  A few services, however , are not available through any documented subsystem function. (Examples include LPCs and various query functions such as NtQueryInformationProcess, specialized functions such as NtCreatePagingFile, and so on.)
  • 12.  Device driver functions that are called through the use of the DeviceIoControl function.  This provides a general interface from user mode to kernel mode to call functions in device drivers that are not associated with a read or write.  Functions that can be called only from kernel mode that are exported and are documented in the WDK.  Functions that are exported and callable from kernel mode but are not documented in the WDK (such as the functions called by the boot video driver, which start with Inbv).  The process and thread manager creates and terminates processes and threads. The underlying support for processes and threads is implemented in the Windows kernel; the executive adds additional semantics and functions to these lower-level objects.
  • 13.  The memory manager implements virtual memory, a memory management scheme that provides a large, private address space for each process.  That can exceed available physical memory. The memory manager also provides the underlying support for the cache manager.
  • 14.  The kernel consists of a set of functions in Ntoskrnl.exe that provide fundamental mechanisms (such as thread scheduling and synchronization services) used by the executive components , as well as low-level hardware architecture–dependent support (such as interrupt and exception dispatching), that is different on each processor architecture.  The kernel code is written primarily in C, with assembly code reserved for those tasks that require access to specialized processor instructions and registers not easily accessible from C.
  • 15.  Processes and Threads in Kernel are implemented as an Object.  In Windows Process is just acts as a container for Threads. That means in Windows Only threads are schedulable Object.  Windows Kernel exposes Process creation and Thread creation facility by ZwCreateProcess and ZwCreateThread.
  • 16.  In Windows context switching occurs When the Application in Windows transit from User Mode to Kernel Mode and Scheduler detects that the time quantum of Thread has been expired , or Application waits for some event to be happen.  In both the cases , Scheduler then tries to search the another Thread that is schedulable and Start it.
  • 17.
  • 18.  Windows scheduler supports both Thread Relative Priority levels and Process Priority.  Process Priority are Low , Below Normal, Normal , Normal , Above Normal , High ,and Realtime .  Whereas Thread Priority levels are 0 to 31 in Windows. That are called Relative Thread Priority Levels because How Windows scheduler interprets them depends on corresponding Process ‘ s Priority .  Every Thread or Process has one Id associated with it . This id is unique throughout the system . And processes and Threads in Windows shares same namespace for ids.  The api for setting Threads or processes priority is SetProcessPriority and SetThreadPriority.
  • 19.  IN Windows Every Application that runs in User Mode has been provided 4 GB of virtual Memory space for its Data and code.  Although , The Actual Memory space that can be used by Windows Application is the Lower half of this address space (x00000000 through x7FFFFFFF) and the upper half is used by Kernel or its Helper modules (x80000000 through xFFFFFFFF ).
  • 20.
  • 21.  The mappings of the lower half change to reflect the virtual address space of the currently executing process.  But the mappings of the upper half always consist of the operating system’s virtual memory.  Because Every process has its own private address space . Then two application can’t access each other’s data or code without proper sharing.  Starting From Windows vista and Windows server 2008 the user can enable or set increaseuserva flag at boot time. Because of this the application that have special flag set in Their Header can have 3 gb of address space. So, The application can allocate or commit more memory than the regular application.