Introduction to Kernel

Slides:



Advertisements
Similar presentations
Chapter 3 Process Description and Control
Advertisements

16 UNIX and Linux. Fig. 16.1: The shell and the kernel.
CMPT 300: Final Review Chapters 8 – Memory Management: Ch. 8, 9 Address spaces Logical (virtual): generated by the CPU Physical: seen by the memory.
Process Description and Control Chapter 3. Major Requirements of an Operating System Interleave the execution of several processes to maximize processor.
2000 Copyrights, Danielle S. Lahmani UNIX Tools G , Fall 2000 Danielle S. Lahmani Lecture 13.
Figure 2.8 Compiler phases Compiling. Figure 2.9 Object module Linking.
Structure of Processes
Home: Phones OFF Please Unix Kernel Parminder Singh Kang Home:
CSCE 351: Operating System Kernels
OS Spring’03 Introduction Operating Systems Spring 2003.
Advanced OS Chapter 3p2 Sections 3.4 / 3.5. Interrupts These enable software to respond to signals from hardware. The set of instructions to be executed.
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
Operating Systems (CSCI2413) Lecture 3 Processes phones off (please)
Process Description and Control A process is sometimes called a task, it is a program in execution.
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.
Protection and the Kernel: Mode, Space, and Context.
OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-1 Process Concepts Department of Computer Science and Software.
The Structure of Processes (Chap 6 in the book “The Design of the UNIX Operating System”)
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
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.
LINUX System : Lecture 7 Bong-Soo Sohn Lecture notes acknowledgement : The design of UNIX Operating System.
Processes Introduction to Operating Systems: Module 3.
Files & File system. A Possible File System Layout Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
UNIX Unit 1- Architecture of Unix - By Pratima.
1  process  process creation/termination  context  process control block (PCB)  context switch  5-state process model  process scheduling short/medium/long.
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
Processes and Virtual Memory
Linux File system Implementations
Process Description and Control Chapter 3. Source Modified slides from Missouri U. of Science and Tech.
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.
1 UNIX – The Kernel. 2 UNIX Internals: Motivations Knowledge of UNIX Internals helps in: –understanding similar systems (for example, NT, LINUX) –designing.
2 Processor(s)Main MemoryDevices Process, Thread & Resource Manager Memory Manager Device Manager File Manager.
Chapter 2 Process Management. 2 Objectives After finish this chapter, you will understand: the concept of a process. the process life cycle. process states.
1 Structure of Processes Chapter 6 Process State and Transition Data Structure for Process Layout of System Memory THE DESIGN OF THE UNIX OPERATING SYSTEM.
1 Process Description and Control Chapter 3. 2 Process A program in execution An instance of a program running on a computer The entity that can be assigned.
What is a Process ? A program in execution.
Introduction Contain two or more CPU share common memory and peripherals. Provide greater system throughput. Multiple processor executing simultaneous.
MINIX Presented by: Clinton Morse, Joseph Paetz, Theresa Sullivan, and Angela Volk.
CSCI/CMPE 4334 Operating Systems Review: Exam 1 1.
WORKING OF SCHEDULER IN OS
Introduction to Operating Systems Concepts
Introduction to Kernel
Processes and threads.
Process Management Process Concept Why only the global variables?
Structure of Processes
Protection of System Resources
Operating Systems: A Modern Perspective, Chapter 6
Processes A process is a running program.
KERNEL ARCHITECTURE.
System Structure and Process Model
System Structure and Process Model
Structure of Processes
Operation System Program 4
System Structure B. Ramamurthy.
An overview of the kernel structure
More examples How many processes does this piece of code create?
System Structure and Process Model
Process & its States Lecture 5.
Process Description and Control
Process Control B.Ramamurthy 2/22/2019 B.Ramamurthy.
LINUX System : Lecture 7 Lecture notes acknowledgement : The design of UNIX Operating System.
Unix Process Control B.Ramamurthy 4/11/2019 B.Ramamurthy.
Implementing Processes, Threads, and Resources
Process Description and Control in Unix
Process Description and Control in Unix
Chapter 1: Introduction CSS503 Systems Programming
Structure of Processes
Mr. M. D. Jamadar Assistant Professor
Presentation transcript:

Introduction to Kernel Topics Kernel Architecture File System Process Reference: The Design of the UNIX Operating System by Maurice J. Bach

kernel Architecture (UNIX) User program Library User level system call interface kernel level File Subsystem Inter process communication Buffer Cache Process Control Subsystem Scheduler Memory Management character block Device driver Hardware control kernel level hardware User level

File System A file system is consists of a sequence of logical blocks (512/1024 byte etc.) A file system has the following structure: Boot Block Super Block Inode List Data Blocks

File System: Boot Block The beginning of the file system Contains bootstrap code to load the operating system Initialize the operating system Typically occupies the first sector of the disk

File System: Super Block Describes the state of a file system Describes the size of the file system How many files it can store Where to find free space on the file system Other information

File System: Inode List Inodes are used to access disk files. Inodes maps the disk files For each file there is an inode entry in the inode list block Inode list also keeps track of directory structure

File System: Data Block Starts at the end of the inode list Contains disk files An allocated data block can belong to one and only one file in the file system

Processes(1) A process is the execution of a program A process is consists of text (machine code), data and stack Many process can run simultaneously as kernel schedules them for execution Several processes may be instances of one program A process reads and writes its data and stack sections, but it cannot read or write the data and stack of other processes A process communicates with other processes and the rest of the world via system calls

Processes(2) Kernel has a process table that keeps tract of all active processes Each entry in the process table contains pointers to the text, data, stack and the U Area of a process. All processes in UNIX system, except the very first process (process 0) which is created by the system boot code, are created by the fork system call

Kernel Support for Process Kernel Process Table Kernel Region Table A Process Per Process Region Table Text File Descriptor Table Data Stack U Area

Process: Region Table Region table entries describes the attributes of the region, such as whether it contains text or data, whether it is shared or private The extra level from the per process region table to kernel region table allows independent processes to share regions.

Process: U Area U Area is the extension of process table entry. Fields of process table entry: State field User ID (UID) Fields of U Area Pointer to process table entry File descriptors of all open files Current directory and current root I/O parameters Process and file size limit Kernel can directly access fields of the U Area of the executing process but not of the U Area of other processes

Process Context The context of a process is its state: Text, data( variable), register Process region table, U Area, User stack and kernel stack When executing a process, the system is said to be executing in the context of the process.

Context Switch When the kernel decides that it should execute another process, it does a context switch, so that the system executes in the context of the other process When doing a context switch, the kernel saves enough information so that it can later switch back to the first process and resume its execution.

Mode of Process Execution(1) The UNIX process runs in two modes: User mode Can access its own instructions and data, but not kernel instruction and data Kernel mode Can access kernel and user instructions and data When a process executes a system call, the execution mode of the process changes from user mode to kernel mode

Mode of Process Execution(2) When moving from user to kernel mode, the kernel saves enough information so that it can later return to user mode and continue execution from where it left off. Mode change is not a context switch, just change in mode.

Process States Process states are: The process is running in user mode The process is running in kernel mode The process is not executing, but it is ready to run as soon as the scheduler chooses it The process is sleeping Such as waiting for I/O to complete

Process State Transition(1) user running system call or interrupt return 2 Interrupt return kernel running schedule process sleep 3 4 ready to run asleep wakeup context switch permissible

Process State Transition(2) The kernel allows a context switch only when a process moves from the state kernel running to the state asleep Process running in kernel mode cannot be preempted by other processes.

Fork System Call(1) When a process is created by fork, it contains duplicate copies of the text, data and stack segments of its parent Also it has a File Descriptor Table (FDT) that contains references to the same opened files as its parent, such that they both share the same file pointer to each opened file

Fork System Call(2) stack data text stack data Kernel File Table Parent Child Region table data text U Area stack U Area data Region table Kernel File Table Kernel Region Table