Linux Operating System

Slides:



Advertisements
Similar presentations
More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
Advertisements

Linux can be generally divided into four major components: 1. KERNEL – OS, ultimate boss The kernel is the core program that runs programs and manages.
File Systems Examples.
Slide 6-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 6 Implementing Processes, Threads, and Resources.
1 UNIX 1 History of UNIX 2 Overview of UNIX 3 Processes in UNIX 4 Memory management in UNIX 5 The UNIX file system 6 Input/output in UNIX.
1 Case Study 1: UNIX and LINUX Chapter History of unix 10.2 Overview of unix 10.3 Processes in unix 10.4 Memory management in unix 10.5 Input/output.
Ceng Operating Systems 10-1 Chapter 10 : Case Study - UNIX History of unix Overview of unix Processes in unix Memory management in unix Input/output.
Process management in Minix1 Processes Process is a program in execution. Program is a static entity while process is an active entity. Process Control.
Process Management. External View of the OS Hardware fork() CreateProcess() CreateThread() close() CloseHandle() sleep() semctl() signal() SetWaitableTimer()
Chapter 3 Memory Management
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.
Process in Unix, Linux and Windows CS-3013 C-term Processes in Unix, Linux, and Windows CS-3013 Operating Systems (Slides include materials from.
Chapter 2 Processes and Threads Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved
File System Variations and Software Caching May 19, 2000 Instructor: Gary Kimura.
Chapter 6 Implementing Processes, Threads, and Resources.
File System Implementation
Guide To UNIX Using Linux Third Edition
Slide 6-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 6.
Processes in Unix, Linux, and Windows CS-502 Fall Processes in Unix, Linux, and Windows CS502 Operating Systems (Slides include materials from Operating.
Chapter 4: Threads Adapted to COP4610 by Robert van Engelen.
Slide 6-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 6.
MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 11 Case Study 2: Windows Vista Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
CS 6560 Operating System Design Lecture 13 Finish File Systems Block I/O Layer.
Process in Unix, Linux, and Windows CS-3013 A-term Processes in Unix, Linux, and Windows CS-3013 Operating Systems (Slides include materials from.
Chapter 4: Threads. 4.2CSCI 380 Operating Systems Chapter 4: Threads Overview Multithreading Models Threading Issues Pthreads Windows XP Threads Linux.
1 Lecture 4: Threads Operating System Fall Contents Overview: Processes & Threads Benefits of Threads Thread State and Operations User Thread.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Lecture 4 Operating Systems.
CSC 322 Operating Systems Concepts Lecture - 4: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Segmentation & O/S Input/Output Chapter 4 & 5 Tuesday, April 3, 2007.
Threads, Thread management & Resource Management.
CASE STUDY 1: Linux and Android Tanenbaum & Bo, Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Memory Management 1 Tanenbaum Ch. 3 Silberschatz Ch. 8,9.
CE Operating Systems Lecture 11 Windows – Object manager and process management.
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.
Chapter 5 File Management File System Implementation.
30 October Agenda for Today Introduction and purpose of the course Introduction and purpose of the course Organization of a computer system Organization.
The Linux Operating System C. Blane Adcock Bryan Knehr Kevin Estep Jason Niesz.
Scis.regis.edu ● CS 468: Advanced UNIX Class 4 Dr. Jesús Borrego Regis University 1.
File System Implementation
Chapter 11: File System Implementation Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Implementation.
System calls for Process management
MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 10 Case Study 1: LINUX Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Files & File system. A Possible File System Layout Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
The UNIX File System (1) Some important directories found in most UNIX systems.
CSC414 “Introduction to UNIX/ Linux” Lecture 2. Schedule 1. Introduction to Unix/ Linux 2. Kernel Structure and Device Drivers. 3. System and Storage.
Threads, Thread management & Resource Management.
The Unix File system (UFS) Presented by: Gurpreet Singh Assistant Professor Department of School of Computing and Engineering Galgotias University.
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.
Lecture 19 Linux/Unix – File System
UNIX File System By Vishal Desai. Introduction Basic purpose of file system: Represent and organize the system resources. But UNIX File System also maps.
Cs431-cotter1 Processes and Threads Tanenbaum 2.1, 2.2 Crowley Chapters 3, 5 Stallings Chapter 3, 4 Silberschaz & Galvin 3, 4.
Chapter 1 Introduction  What is an operating system  History of operating systems  The operating system zoo  Computer hardware review  Operating system.
What is a Process ? A program in execution.
System calls for Process management Process creation, termination, waiting.
MINIX Presented by: Clinton Morse, Joseph Paetz, Theresa Sullivan, and Angela Volk.
MODERN OPERATING SYSTEMS Third Edition ANDREW S
Chapter 12: File System Implementation
Case Study 1: UNIX and LINUX
CASE STUDY 1: Linux and Android
Operating Systems: A Modern Perspective, Chapter 6
Chapter 4: Threads.
Processes in Unix, Linux, and Windows
Operating Systems Lecture 1.
Processes in Unix, Linux, and Windows
Implementing Processes, Threads, and Resources
Process Description and Control in Unix
Process Description and Control in Unix
Implementing Processes, Threads, and Resources
Presentation transcript:

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

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

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

Linux Utility Programs 4/17/2017 Figure 10-2. 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. 0-13-6006639 cs431-cottercs431-cotter

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

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

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

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

Implementation of Exec 4/17/2017 Figure 10-8. 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. 0-13-6006639 cs431-cottercs431-cotter

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

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

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

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

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

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

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

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

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

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

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

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

Memory Management in Linux (1) 4/17/2017 (a) (b) (c) Figure 10-12. (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. 0-13-6006639 cs431-cottercs431-cotter

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

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

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

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

Implementation of Input/Output 4/17/2017 Figure 10-22. 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. 0-13-6006639 cs431-cottercs431-cotter

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

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

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

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

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

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

The Linux Ext2 File System (4) 4/17/2017 Figure 10-34. 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. 0-13-6006639 cs431-cottercs431-cotter

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

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

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

NFS Protocols 4/17/2017 Figure 10-35. 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. 0-13-6006639 cs431-cottercs431-cotter

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

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

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

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

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

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