0% found this document useful (0 votes)
14 views17 pages

OSLabPresentation 1

A presentation on the topic of kernals and threads in operating systems , it includes all content related to the topic of kernals in the os and a fully

Uploaded by

Lyba
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views17 pages

OSLabPresentation 1

A presentation on the topic of kernals and threads in operating systems , it includes all content related to the topic of kernals in the os and a fully

Uploaded by

Lyba
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

Kernels in Different OS & Threads

Syed Farhan Jafri (21L-6074)


Laiba Habib (21L-6102)
Sadia Saleem (21L-6081)
Kernels

 The most important part of the operating system.


 Primary interface between the hardware and the processes of a computer
 The kernel connects these two in order to adjust resources
 One of the initial programs loaded up on memory before the boot loader.
 Several important jobs, like process and memory management, disk
storage, and low-level networking
Types of Kernels

1. Monolithic:
User services and the kernel services are implemented in the same memory space
Advantages: Scheduling through system calls, Larger kernel size
Disadvantages: One service fails = whole system fails

2. Microkernel:
User services and the kernel services are implemented in different memory space
Advantages: New services are easily added
Disadvantages: Execution time is increased due to communication
3. Hybrid Kernel:
Speed of Monolithic Kernel and the modularity of Microkernel
“Non-essential" code in kernel-space is used in order for the code to run more quickly than it would be in user-space

4. Nanokernel
Code executing in the privileged mode of the hardware is very small
Nanosecond clock resolution is supported

5. Exokernel
Very complex design
Resource protection is separated from the management
Allows to perform application-specific customization
Kernels in Windows

 Windows NT (New Technology)


 Written in C Language by Microsoft
 First released on July 27, 1993
 Has full access to the hardware and system resources of the computer and
runs code in a protected memory area
 Scheduling, thread prioritization, memory management and the interaction
with hardware.
 Supports four different privilege levels (numbered 0 to 3), only the two
extreme privilege levels are used
 Usermode programs are run with CPL 3, and the kernel runs with
CPL 0.
Kernels in macOS, iOS

 XNU (X is Not Unix)


 Written in C, C++ Language by Apple Inc.
 First release in December 1996
 Free and open-source software as part of the Darwin OS
 XNU is a hybrid kernel
 Message passing ability of microkernels enabling greater
modularity and benefit from memory protection
 The speed of monolithic kernels for some critical tasks
Kernels in Linux, Android, ChromeOS

 Linux Kernel
 Used in Ubuntu, webOS, Firefox OS, etc.
 Written in C Language in 1991 by Linus Torvalds
 Free and open-source, monolithic kernel
 Can insert and remove loadable kernel modules at runtime
 True parallel processing, IPC with synchronization.
Kernels in FuchsiaOS (Google)

 Zircon
 Used in Google Nest Hub
 Written in C++ Language by Google
 Custom made open-source software released on May 25, 2021
 Composed of a kernel with a small set of user services, drivers,
and libraries
 Resources are represented as objects rather than files
Kernels in Solaris (Oracle)

 Solaris Kernel
 Written in C Language by Sun Microsystems
 First released in June 1992
 Monolithic kernel with dynamically loadable modules
 Open source kernel
Threads
Threads

 Smallest unit of processing that can be scheduled by an OS


 Single sequential flow of activities being executed in a process
 Share common data without needing to communicate with each other.
 Context switching is faster.
 Terminating a thread requires less time than terminating a process.
User-Level Threads

 Simple to implement and are done so by the user.


 Managed as single-threaded processes by the kernel-level thread.
 User threads are easier to implement than kernel threads.
 Threads at the user level can be used in OS that do not allow threads at the kernel level.
 It is more effective and efficient.
 Context switching takes less time than kernel threads.
 It does not necessitate any changes to the operating system.
Kernel-Level Threads

 The operating system is recognized by the


kernel thread.
 Each thread and process in the kernel-level
thread has its own TCB as well as PCB in the
system
 The kernel-level thread provides a system call
for user-space thread creation and management.
 More complex to build than user threads,
context switch time is longer.
 All threads are completely aware of the kernel-
level thread.
Benefits of Threads

 Enhanced system throughput: No. of job completed per unit time increases when the process is divided
into numerous thread
 Effective use of a Multiprocessor system: Schedule multiple threads in multiple processors when you have
many threads in a single process.
 Faster context switch: The thread context switching time is shorter than the process context switching time.
 Responsiveness: When a process is divided into many threads, and each of them completes its execution,
response time increases.
 Communication: Multiple-thread communication is straightforward because the threads use the same
address space.
 Resource sharing: Code, data, and files can be shared among all threads in a process.
Thread Functions

 Thread functions include creating, joining, and detaching


threads.
 pthread_create function is used to create a new thread
 pthread_join function waits for a thread to finish its
execution
 pthread_detach function detaches a thread from the main
program.
Synchronization

 Threads are used to avoid race conditions and deadlocks.

 Mutexes are used to protect shared resources from simultaneous access

 pthread_mutex_lock and pthread_mutex_unlock functions are used to acquire and


release a mutex.
Thank You!
Made by:
Syed Farhan Jafri
21L-6074
Laiba Habib
21L-6102
Sadia Saleem
21L-6081

You might also like