Reference Architecture: Red Hat Enterprise Linux OpenStack ...
Linux System Architecture - Home | SICS
Transcript of Linux System Architecture - Home | SICS
![Page 2: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/2.jpg)
2
Tehran
Polytechnic
University
Contents What is Kernel? Kernel Architecture Overview
User Space Kernel Space
Kernel Functional Overview File System Process Management Device Driver Memory Management Networking
![Page 3: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/3.jpg)
3
Tehran
Polytechnic
University
What is Kernel ? Modules or sub-systems that provide
the operating system functions. The Core of OS It is written in C
![Page 4: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/4.jpg)
4
Tehran
Polytechnic
University
Contents What is Kernel? Kernel Architecture Overview
User Space Kernel Space
Kernel Functional Overview File System Process Management Device Driver Memory Management Networking
![Page 5: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/5.jpg)
5
Tehran
Polytechnic
University
Kernel Architecture Overview
User Space Kernel Space Data Flow Between User Space and
Kernel Space
![Page 6: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/6.jpg)
6
Tehran
Polytechnic
University
User Space The User Space is the space in memory
where user processes run. This memory is above the Kernel.
It includes the rest of available memory. This Space is protected.
The system prevents one process from interfering with another process.
Only Kernel processes can access a user process
![Page 7: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/7.jpg)
7
Tehran
Polytechnic
University
Kernel Space The Kernel Space is the space in
memory where all kernel services are provided via kernel processes.
The user has access to it only through the system call. A user process becomes a kernel process
when it executes a system call.
![Page 8: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/8.jpg)
8
Tehran
Polytechnic
University
System Call
User Space and Kernel Space are in different spaces.
When a System Call is executed, the arguments to the call are passed from User Space to Kernel Space.
![Page 9: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/9.jpg)
9
Tehran
Polytechnic
University
User Space and Kernel Space Relationship
UserProcess
Library Routine
Syscall Dispatch
KernelService
User SpaceKernel Space
Data Flow
![Page 10: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/10.jpg)
10
Tehran
Polytechnic
University
Contents What is Kernel? Kernel Architecture Overview
User Space Kernel Space
Kernel Functional Overview File System Process Management Device Driver Memory Management Networking
![Page 11: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/11.jpg)
11
Tehran
Polytechnic
University
Kernel Functional Overview
File System Process Management Device Driver Memory Management Networking
![Page 12: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/12.jpg)
12
Tehran
Polytechnic
University
Kernel Functional Overview
![Page 13: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/13.jpg)
13
Tehran
Polytechnic
University
Functional Layer & Architectural Layer
![Page 14: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/14.jpg)
14
Tehran
Polytechnic
University
Contents What is Kernel? Kernel Architecture Overview
User Space Kernel Space
Kernel Functional Overview File System Process Management Device Driver Memory Management Networking
![Page 15: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/15.jpg)
15
Tehran
Polytechnic
University
File System It is responsible for storing information
on disk and retrieving and updating this information.
The File System is accessed through system calls such as : open, read, write, …
Example : FAT16, FAT32, NTFS ext2, ext3 …
![Page 16: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/16.jpg)
16
Tehran
Polytechnic
University
File System (Cont.)
The Unix system has the following types of files: Ordinary Files
Contain information entered into them by a user, an application or …
Directory Files Manage the cataloging of the file system
Special Files (devices) Used to access the peripheral devices
FIFO Files for Pipes
![Page 17: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/17.jpg)
17
Tehran
Polytechnic
University
File System (Cont.)
/
/bin /etc /dev … /usr /home /root
ls ping A B
data.txt pic.gif
![Page 18: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/18.jpg)
18
Tehran
Polytechnic
University
File System Structure
Boot Block : information needs to boot the system Super Block : File System Specifications
SizeMax. number of filesFree blocksFree inodes
inode List Block List : The files data
BootBlock
SuperBlock
inodeList
BlockList
![Page 19: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/19.jpg)
19
Tehran
Polytechnic
University
Inode Each file has an inode structure that is
identified by an i-number. The inode contains the information
required to access the file. It doesn’t contain file name.
![Page 20: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/20.jpg)
20
Tehran
Polytechnic
University
Inode (Cont.)
![Page 21: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/21.jpg)
21
Tehran
Polytechnic
University
Directories
FileName
inode Number
![Page 22: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/22.jpg)
22
Tehran
Polytechnic
University
Contents What is Kernel? Kernel Architecture Overview
User Space Kernel Space
Kernel Functional Overview File System Process Management Device Driver Memory Management Networking
![Page 23: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/23.jpg)
23
Tehran
Polytechnic
University
Process Management The Unix OS is a time-sharing system. Every process is scheduled to run for a
period of time (time slice). Kernel creates, manages and deletes
the processes
![Page 24: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/24.jpg)
24
Tehran
Polytechnic
University
Process Management (Cont.)
In the Unix system process 0, called the swapper, is always assigned to the process and CPU scheduler.
It manages the complete operation of process scheduling and swapping.
Process 0 is create as a part of system boot-up. Every other process in the system is create as
the result of a fork system call. The fork system call splits a process into two
processes (Parent and Child). Each process has a unique identifier (Process
ID).
![Page 25: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/25.jpg)
25
Tehran
Polytechnic
University
Process Management (cont.)
Each process is represented by a task_struct data structure. It contains the specifications of each process such
as: State Scheduling information Identifier …
The task_vector is an array of pointers to every task_struct data structure in the system. This means that the maximum number of processes
in the system is limited by the size of the task vector
![Page 26: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/26.jpg)
26
Tehran
Polytechnic
University
Type of Processes Running
The process is either running or it is ready to run.
Waiting The process is waiting for an event or for a
resource.
Stopped The process has been stopped, usually by
receiving a signal.
Zombie This is a halted process which, for some
reason, still has a task_struct data structure in the task vector.
![Page 27: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/27.jpg)
27
Tehran
Polytechnic
University
Contents What is Kernel? Kernel Architecture Overview
User Space Kernel Space
Kernel Functional Overview File System Process Management Device Driver Memory Management Networking
![Page 28: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/28.jpg)
28
Tehran
Polytechnic
University
Device Driver Associated with each physical device or
virtual device is a piece of code, called device driver, which manage the device hardware.
The main functions of device driver: Setting up hardware on initialization. Bringing the associated devices into and out
of services. Receiving data from the hardware and
passing it back to the kernel. Sending data from the kernel to the device. Detecting and handling device errors.
![Page 29: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/29.jpg)
29
Tehran
Polytechnic
University
Type of devices Every thing in Unix is a file.
Each device is like a file. Character devices
A character (char) device is one that can be accessed as a stream of bytes.
Example : Keyboard, Mouse, …
Block devices A block device can be accessed only as multiples
of a block, where a block is usually one kilobyte of data or another power of 2.
Example : disk, …
![Page 30: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/30.jpg)
30
Tehran
Polytechnic
University
Major Number and Minor Number
Major Number The major number identifies the driver
associated with the device. Minor Number
The minor number is used only by the driver specified by the major number; other parts of the kernel don't use it.
It is common for a driver to control several devices, the minor number provides a way for the driver to differentiate among them.
![Page 31: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/31.jpg)
31
Tehran
Polytechnic
University
Device Driver (Cont.)
![Page 32: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/32.jpg)
32
Tehran
Polytechnic
University
Contents What is Kernel? Kernel Architecture Overview
User Space Kernel Space
Kernel Functional Overview File System Process Management Device Driver Memory Management Networking
![Page 33: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/33.jpg)
33
Tehran
Polytechnic
University
Memory Management Physical memory is divided into
segments of equal size, called pages. Type of memory:
Physical memory Virtual memory Swap memory
![Page 34: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/34.jpg)
34
Tehran
Polytechnic
University
Virtual and swap memory Swap
It is a configurable partition on disk treated in a manner similar to memory.
Virtual memory Processes swapping in and out of memory on a
recurring basis fragment physical memory. It is impossible to guarantee that exactly the same
physical memory blocks will be available to a specific process.
Virtual address space solves this problem by assigning contiguous virtual memory blocks to a process.
These blocks are mapped to physical memory when a process is swap in, and to swap device memory when the process is swapped out.
![Page 35: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/35.jpg)
35
Tehran
Polytechnic
University
Physical and Virtual memory
![Page 36: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/36.jpg)
36
Tehran
Polytechnic
University
Contents What is Kernel? Kernel Architecture Overview
User Space Kernel Space
Kernel Functional Overview File System Process Management Device Driver Memory Management Networking
![Page 37: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/37.jpg)
37
Tehran
Polytechnic
University
Networking The first integrated communication
capability in Unix was developed for Berkeley Unix 4.2bsd as the sockets implementation.
Sockets provide a programming interface for networking.
![Page 38: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/38.jpg)
38
Tehran
Polytechnic
University
Contents What is Kernel? Kernel Architecture Overview
User Space Kernel Space
Kernel Functional Overview File System Process Management Device Driver Memory Management Networking
![Page 39: Linux System Architecture - Home | SICS](https://reader036.fdocuments.us/reader036/viewer/2022071601/613d3888736caf36b75ac089/html5/thumbnails/39.jpg)
39
Tehran
Polytechnic
University
Question?