Presentation is loading. Please wait.

Presentation is loading. Please wait.

Linux Operating System

Similar presentations


Presentation on theme: "Linux Operating System"— Presentation transcript:

1 Linux Operating System
4/17/2017 4/17/2017 Linux Operating System Review Chapter 10 cs431-cotter cs431-cotter cs431-cottercs431-cotter 1

2 Overview System Overview Linux Processes CPU Scheduler
4/17/2017 4/17/2017 System Overview Linux Processes CPU Scheduler Process Synchronization Memory Management Input / Output File Systems Security cs431-cotter cs431-cottercs431-cotter cs431-cotter 2

3 Figure 10-1. The layers in a Linux system.
Interfaces to Linux 4/17/2017 Figure The layers in a Linux system. cs431-cotter Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved cs431-cottercs431-cotter

4 Linux Utility Programs
4/17/2017 Figure A few of the common Linux utility programs required by POSIX. cs431-cotter Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved cs431-cottercs431-cotter

5 Figure 10-3. Structure of the Linux kernel
Kernel Structure 4/17/2017 Figure Structure of the Linux kernel cs431-cotter Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved cs431-cottercs431-cotter

6 Overview System Overview Linux Processes CPU Scheduler
4/17/2017 4/17/2017 System Overview Linux Processes CPU Scheduler Process Synchronization Memory Management Input / Output File Systems Security cs431-cotter cs431-cottercs431-cotter cs431-cotter 6

7 Linux Processes int pid; : pid = fork (); //create a child process
if (pid < 0) // fork failed!! errexit(); // handle error else if (pid == 0) { : //child process work goes here } else //pid must be > 0 { : //parent process work goes here cs431-cotter

8 Process Management System Calls in Linux
4/17/2017 Figure Some system calls relating to processes. cs431-cotter Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved cs431-cottercs431-cotter

9 Implementation of Exec
4/17/2017 Figure The steps in executing the command ls typed to the shell. cs431-cotter Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved cs431-cottercs431-cotter

10 Overview System Overview Linux Processes CPU Scheduler
4/17/2017 4/17/2017 System Overview Linux Processes CPU Scheduler Process Synchronization Memory Management Input / Output File Systems Security cs431-cotter cs431-cottercs431-cotter cs431-cotter 10

11 Linux Scheduling Algorithm
4/17/2017 4/17/2017 Linux Scheduling Algorithm SCHED_FIFO Designed for static priority. Soft real-time processes. SCHED_RR designed for real-time processes that require fair assignment of CPU time. SCHED_OTHER designed for normal user processes. Preemptible. Priority determined by base priority and time remaining in quantum. cs431-cotter cs431-cotter cs431-cottercs431-cotter 11

12 Scheduling in Linux 4/17/2017 Figure Illustration of Linux runqueue and priority arrays. cs431-cotter Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved cs431-cottercs431-cotter

13 Overview System Overview Linux Processes CPU Scheduler
4/17/2017 4/17/2017 System Overview Linux Processes CPU Scheduler Process Synchronization Memory Management Input / Output File Systems Security cs431-cotter cs431-cottercs431-cotter cs431-cotter 13

14 Figure 10-5. The signals required by POSIX.
Signals in Linux (1) 4/17/2017 Figure The signals required by POSIX. cs431-cotter Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved cs431-cottercs431-cotter

15 Signals must be captured with signal handler
4/17/2017 4/17/2017 Signals must be captured with signal handler Program must explicitly handle signals, if it does not want to use default handling (usually termination) sigaction (signal_to_catch, new_action, old_action) struct sigaction { void * sa_handler; // What function do we call? sigset_t mask; // Mask of signals to block when called int sa_flags; // Special flags to set. }; Will be executed automatically on reception of appropriate signal cs431-cotter cs431-cotter cs431-cottercs431-cotter 15

16 Semaphores POSIX version of semaphores System V version of semaphores
4/17/2017 4/17/2017 Semaphores POSIX version of semaphores #include <semaphore.h> classic semaphore implementation System V version of semaphores #include <sys/sem.h> Enhanced version of semaphores to include sets cs431-cotter cs431-cotter cs431-cottercs431-cotter 16

17 Figure 2-30. Some of the Pthreads calls relating to mutexes.
Mutexes in Pthreads 4/17/2017 Figure Some of the Pthreads calls relating to mutexes. cs431-cotter Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved cs431-cottercs431-cotter

18 Named Pipes Permanent objects
4/17/2017 4/17/2017 Named Pipes Permanent objects Available to processes that can access the filespace (same system or on a shared file system) Processes do not have to be related. cs431-cotter cs431-cotter cs431-cottercs431-cotter 18

19 Message Queues A “linked list of messages”
Message queue has kernel persistence Supports asynchronous communications. Messages are stored in the queue, independent of the sender (sender can close queue without losing messages). Receiver can retrieve messages at a later time. Messages have a priority Higher priority messages are retrieved first (POSIX) Max priority is 32768 cs431-cotter

20 Shared Memory Allows 2 or more processes to share the same main memory space Memory can be allocated as blocks (pages) of memory Memory can be mapped as a file that is available in memory to multiple processes cs431-cotter

21 Overview System Overview Linux Processes CPU Scheduler
4/17/2017 4/17/2017 System Overview Linux Processes CPU Scheduler Process Synchronization Memory Management Input / Output File Systems Security cs431-cotter cs431-cottercs431-cotter cs431-cotter 21

22 Memory Management in Linux (1)
4/17/2017 (a) (b) (c) Figure (a) Process A’s virtual address space. (b) Physical memory. (c) Process B’s virtual address space. cs431-cotter Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved cs431-cottercs431-cotter

23 Memory Management in Linux (2)
4/17/2017 (a) (b) (c) Figure Two processes can share a mapped file. cs431-cotter Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved cs431-cottercs431-cotter

24 Physical Memory Management (3)
4/17/2017 Figure Linux uses four-level page tables. cs431-cotter Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved cs431-cottercs431-cotter

25 Memory Allocation Mechanisms
4/17/2017 (a) (b) (c) (d) (e) (f) (g) (h) (i) Figure Operation of the buddy algorithm. cs431-cotter Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved cs431-cottercs431-cotter

26 Overview System Overview Linux Processes CPU Scheduler
4/17/2017 4/17/2017 System Overview Linux Processes CPU Scheduler Process Synchronization Memory Management Input / Output File Systems Security cs431-cotter cs431-cottercs431-cotter cs431-cotter 26

27 Implementation of Input/Output
4/17/2017 Figure The Linux I/O system showing one file system in detail. cs431-cotter Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved cs431-cottercs431-cotter

28 Overview System Overview Linux Processes CPU Scheduler
4/17/2017 4/17/2017 System Overview Linux Processes CPU Scheduler Process Synchronization Memory Management Input / Output File Systems Security cs431-cotter cs431-cottercs431-cotter cs431-cotter 28

29 System Organization Like UNIX...
4/17/2017 4/17/2017 System Organization Like UNIX... Predefined root directory structure with preferred locations for kernel files / (root) bin dev home mnt root tmp var boot etc lib proc sbin usr cs431-cotter cs431-cottercs431-cotter cs431-cotter 29

30 The Linux File System (2)
4/17/2017 Figure (a) Before linking. (b) After linking. cs431-cotter Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved cs431-cottercs431-cotter

31 The Linux File System (3)
4/17/2017 Figure (a) Separate file systems. (b) After mounting. cs431-cotter Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved cs431-cottercs431-cotter

32 The Linux Virtual File System
4/17/2017 Figure File system abstractions supported by the VFS. cs431-cotter Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved cs431-cottercs431-cotter

33 The Linux Ext2 File System (1)
4/17/2017 Figure Disk layout of the Linux ext2 file system. cs431-cotter Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved cs431-cottercs431-cotter

34 The Linux Ext2 File System (4)
4/17/2017 Figure The relation between the file descriptor table, the open file description table, and the i-node table. cs431-cotter Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved cs431-cottercs431-cotter

35 4/17/2017 4/17/2017 Journal File Systems Designed to speed file system recovery from system crashes. Traditional systems use an fs recovery tool (e.g. fsck) to verify system integrity As file system grows, recovery time grows. Journal File Systems track changes in meta-data to allow rapid recovery from crashes cs431-cotter cs431-cotter cs431-cottercs431-cotter 35

36 4/17/2017 4/17/2017 Journal File System Uses a version of a transaction log to track changes to file system directory records. If a system crash occurs, the transaction log can be reviewed back to a check point to verify any pending work (either undo or redo). For large systems, recovery time goes from hours or days to seconds. cs431-cotter cs431-cotter cs431-cottercs431-cotter 36

37 Journal File System - Examples
4/17/2017 4/17/2017 Journal File System - Examples ReiserFS Designed originally for Linux (32 bit system) Supports file systems to 2TB -> 16TB Journal support of meta-data Btree structure supports large file counts Supports block packing for small files No fixed inode allocation - more flexible. cs431-cotter cs431-cotter cs431-cottercs431-cotter 37

38 NFS Protocols 4/17/2017 Figure Examples of remote mounted file systems. Directories shown as squares, files shown as circles. cs431-cotter Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved cs431-cottercs431-cotter

39 Figure 10-36. The NFS layer structure
NFS Implementation 4/17/2017 Figure The NFS layer structure cs431-cotter Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved cs431-cottercs431-cotter

40 Overview System Overview Linux Processes CPU Scheduler
4/17/2017 4/17/2017 System Overview Linux Processes CPU Scheduler Process Synchronization Memory Management Input / Output File Systems Security cs431-cotter cs431-cottercs431-cotter cs431-cotter 40

41 Figure 10-37. Some example file protection modes.
Security In Linux 4/17/2017 Figure Some example file protection modes. cs431-cotter Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved cs431-cottercs431-cotter

42 Security System Calls in Linux
4/17/2017 Figure system calls relating to security. cs431-cotter Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved cs431-cottercs431-cotter

43 Summary System Overview Linux Processes CPU Scheduler
Process Synchronization Memory Management Input / Output File Systems Security cs431-cotter

44 Questions What command would be needed to print the last 250 characters of a file “data.txt” What function can a parent process use to capture the exit code from a child process? In terms of Linux scheduling what is a runqueue? How does Linux use the Buddy algorithm to allocate memory for a process? What information is kept in an open file description table that isn’t kept anywhere else? What is the primary advantage of a journaling file system over earlier file systems (such as ext2fs)? cs431-cotter


Download ppt "Linux Operating System"

Similar presentations


Ads by Google