CSC 660 Advanced OS Introduction CSC 660 Advanced
![CSC 660: Advanced OS Introduction CSC 660: Advanced Operating Systems 1 CSC 660: Advanced OS Introduction CSC 660: Advanced Operating Systems 1](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-1.jpg)
![Who am I? http: //www. nku. edu/~waldenj 1 James Walden – Assistant Professor of Who am I? http: //www. nku. edu/~waldenj 1 James Walden – Assistant Professor of](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-2.jpg)
![Course Administration Web Site http: //www. nku. edu/~waldenj 1/classes/2006/spring/csc 660 Notes, readings, and assignments Course Administration Web Site http: //www. nku. edu/~waldenj 1/classes/2006/spring/csc 660 Notes, readings, and assignments](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-3.jpg)
![Course Information Prerequisites CSC 560, CSC 601 Laboratory Facilities FH 102 VMWare image Textbooks Course Information Prerequisites CSC 560, CSC 601 Laboratory Facilities FH 102 VMWare image Textbooks](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-4.jpg)
![Course Goals 1. A deep understanding of operating system principles. 2. A solid grasp Course Goals 1. A deep understanding of operating system principles. 2. A solid grasp](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-5.jpg)
![Grading Grades are based on – Individual programming assignments. – Group projects. CSC 660: Grading Grades are based on – Individual programming assignments. – Group projects. CSC 660:](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-6.jpg)
![Assignment Policy Available on web page. Your responsibility to check for announcements. Types of Assignment Policy Available on web page. Your responsibility to check for announcements. Types of](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-7.jpg)
![Topics A first look at four important questions: – What is the kernel? – Topics A first look at four important questions: – What is the kernel? –](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-8.jpg)
![What is an OS kernel? Program that is always running. – Manages resources. – What is an OS kernel? Program that is always running. – Manages resources. –](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-9.jpg)
![What is an OS kernel? CSC 660: Advanced Operating Systems 10 What is an OS kernel? CSC 660: Advanced Operating Systems 10](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-10.jpg)
![Resource Management Allocation Allocates finite resources among competing processes. CPU, memory, disk, network Protection Resource Management Allocation Allocates finite resources among competing processes. CPU, memory, disk, network Protection](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-11.jpg)
![What is the Linux kernel? Free open source UNIX-compatible kernel. Created by Linus Torvalds. What is the Linux kernel? Free open source UNIX-compatible kernel. Created by Linus Torvalds.](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-12.jpg)
![Kernel History 0. 01 1. 0 1. 2 2. 0 2. 2 2. 4 Kernel History 0. 01 1. 0 1. 2 2. 0 2. 2 2. 4](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-13.jpg)
![Version Numbering: A. B. C. D A: Major version Changed twice: 1. 0 (1994), Version Numbering: A. B. C. D A: Major version Changed twice: 1. 0 (1994),](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-14.jpg)
![Kernel Versions mm: Andrew Morton tree New patches, almost ready for distribution. ac: Alan Kernel Versions mm: Andrew Morton tree New patches, almost ready for distribution. ac: Alan](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-15.jpg)
![Identifying the Running Kernel > uname Linux > uname -r 2. 6. 10 > Identifying the Running Kernel > uname Linux > uname -r 2. 6. 10 >](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-16.jpg)
![Investigating the Running Kernel: /proc ###: directory for each running process cpuinfo: processor information Investigating the Running Kernel: /proc ###: directory for each running process cpuinfo: processor information](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-17.jpg)
![Process information > ls -al. F /proc/self dr-xr-xr-x 2 jw jw 0 -r---- 1 Process information > ls -al. F /proc/self dr-xr-xr-x 2 jw jw 0 -r---- 1](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-18.jpg)
![Process information > cd /proc/self > cat cmdline ; echo -bash > cat environ Process information > cd /proc/self > cat cmdline ; echo -bash > cat environ](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-19.jpg)
![Obtaining the Kernel CSC 660: Advanced Operating Systems 20 Obtaining the Kernel CSC 660: Advanced Operating Systems 20](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-20.jpg)
![Prepatches and Snapshots Prepatches Alpha versions of the kernel, located in the testing/ subdirectory Prepatches and Snapshots Prepatches Alpha versions of the kernel, located in the testing/ subdirectory](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-21.jpg)
![Obtaining the Kernel Select the kernel version you need 2. 6. 10 for our Obtaining the Kernel Select the kernel version you need 2. 6. 10 for our](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-22.jpg)
![Linux Source Layout CSC 660: Advanced Operating Systems 23 Linux Source Layout CSC 660: Advanced Operating Systems 23](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-23.jpg)
![Documentation Text files documenting various aspects of kernel Can be very useful. Not well Documentation Text files documenting various aspects of kernel Can be very useful. Not well](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-24.jpg)
![arch Architecture dependent code. Subdirectories for all current archs (22 in 2. 6. 10) arch Architecture dependent code. Subdirectories for all current archs (22 in 2. 6. 10)](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-25.jpg)
![arch/i 386 boot/ crypto/ kernel/ lib/ mach-*/ math-emu/ oprofile/ pci/ power/ x 86 -specific arch/i 386 boot/ crypto/ kernel/ lib/ mach-*/ math-emu/ oprofile/ pci/ power/ x 86 -specific](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-26.jpg)
![drivers Hardware device drivers. Largest division of kernel code. Major subdirectories char/ block/ net/ drivers Hardware device drivers. Largest division of kernel code. Major subdirectories char/ block/ net/](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-27.jpg)
![fs Virtual filesystem framework code. Subdirectories for actual filesystems. ext 2/ ext 3/ hfs/ fs Virtual filesystem framework code. Subdirectories for actual filesystems. ext 2/ ext 3/ hfs/](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-28.jpg)
![include/asm-* Architecture dependent subdirectories. include/linux Headers needed by both kernel and user apps. User include/asm-* Architecture dependent subdirectories. include/linux Headers needed by both kernel and user apps. User](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-29.jpg)
![init Kernel startup code version. c: kernel version banner; prints at boot. main. c: init Kernel startup code version. c: kernel version banner; prints at boot. main. c:](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-30.jpg)
![ipc System V UNIX IPC Interprocess Communication Facilities sem. c shm. c msg. c ipc System V UNIX IPC Interprocess Communication Facilities sem. c shm. c msg. c](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-31.jpg)
![kernel Core kernel code. Scheduler sched. c Process Control fork. c, exit. c, signal. kernel Core kernel code. Scheduler sched. c Process Control fork. c, exit. c, signal.](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-32.jpg)
![lib Kernel cannot call standard C library. lib/ contains kernel’s own library routines Optimized lib Kernel cannot call standard C library. lib/ contains kernel’s own library routines Optimized](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-33.jpg)
![mm Memory management memory. c filemap. c Page table setup, page faults File memory mm Memory management memory. c filemap. c Page table setup, page faults File memory](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-34.jpg)
![net Low level networking protocols atm/, bluetooth/, decnet/ ethernet/ TCP/IP networking: ipv 4/ and net Low level networking protocols atm/, bluetooth/, decnet/ ethernet/ TCP/IP networking: ipv 4/ and](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-35.jpg)
![scripts Kernel scripts for Building documentation Kernel configuration CSC 660: Advanced Operating Systems 36 scripts Kernel scripts for Building documentation Kernel configuration CSC 660: Advanced Operating Systems 36](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-36.jpg)
![Kernel Reading Online cross-referenced linux source tree http: //lxr. linux. no/source/ Build your own Kernel Reading Online cross-referenced linux source tree http: //lxr. linux. no/source/ Build your own](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-37.jpg)
![Quick Kernel Build 1. Configure make xconfig 2. Build make –j 3 bz. Image Quick Kernel Build 1. Configure make xconfig 2. Build make –j 3 bz. Image](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-38.jpg)
![Configuring the Kernel kbuild: the kernel build system Kernel configuration cp. config. save make Configuring the Kernel kbuild: the kernel build system Kernel configuration cp. config. save make](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-39.jpg)
![. config CONFIG_<NAME> options y Include in kernel n Don’t include in kernel m . config CONFIG_<NAME> options y Include in kernel n Don’t include in kernel m](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-40.jpg)
![Important Options Code Maturity Level Options Experimental: Allow alpha-quality drivers. Clean compile: May not Important Options Code Maturity Level Options Experimental: Allow alpha-quality drivers. Clean compile: May not](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-41.jpg)
![Building the Kernel Top kernel Makefile Reads configuration from. config. Updates include/linux/version. h Sets Building the Kernel Top kernel Makefile Reads configuration from. config. Updates include/linux/version. h Sets](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-42.jpg)
![Building the Kernel In each subdirectory, Makefile. build reads the Makefile in that subdirectory. Building the Kernel In each subdirectory, Makefile. build reads the Makefile in that subdirectory.](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-43.jpg)
![Installing the Kernel Copy the kernel to /boot cp arch/i 386/boot/bz. Image -VERSION Copy Installing the Kernel Copy the kernel to /boot cp arch/i 386/boot/bz. Image -VERSION Copy](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-44.jpg)
![Configuring the Bootloader is amall program residing on MBR. BIOS loads MBR and starts Configuring the Bootloader is amall program residing on MBR. BIOS loads MBR and starts](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-45.jpg)
![References 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. Daniel P. Bovet References 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. Daniel P. Bovet](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-46.jpg)
- Slides: 46
![CSC 660 Advanced OS Introduction CSC 660 Advanced Operating Systems 1 CSC 660: Advanced OS Introduction CSC 660: Advanced Operating Systems 1](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-1.jpg)
CSC 660: Advanced OS Introduction CSC 660: Advanced Operating Systems 1
![Who am I http www nku eduwaldenj 1 James Walden Assistant Professor of Who am I? http: //www. nku. edu/~waldenj 1 James Walden – Assistant Professor of](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-2.jpg)
Who am I? http: //www. nku. edu/~waldenj 1 James Walden – Assistant Professor of Computer Science – waldenj@nku. edu – Interests: • • Software Assurance Information Security Programming Languages Network Security CSC 660: Advanced Operating Systems 2
![Course Administration Web Site http www nku eduwaldenj 1classes2006springcsc 660 Notes readings and assignments Course Administration Web Site http: //www. nku. edu/~waldenj 1/classes/2006/spring/csc 660 Notes, readings, and assignments](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-3.jpg)
Course Administration Web Site http: //www. nku. edu/~waldenj 1/classes/2006/spring/csc 660 Notes, readings, and assignments on web site. Assignment submission Send electronic submissions to waldenj@nku. edu Contact Information Email: waldenj@nku. edu Phone: (859) 572 -5571 Office Hours: MW 3: 00 -4: 00, R 3: 00 -4: 00 CSC 660: Advanced Operating Systems 3
![Course Information Prerequisites CSC 560 CSC 601 Laboratory Facilities FH 102 VMWare image Textbooks Course Information Prerequisites CSC 560, CSC 601 Laboratory Facilities FH 102 VMWare image Textbooks](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-4.jpg)
Course Information Prerequisites CSC 560, CSC 601 Laboratory Facilities FH 102 VMWare image Textbooks Linux Kernel Development, 2 nd edition, Robert Love, Prentice-Hall, 2005. Understanding the Linux Kernel, 3 rd edition, Daniel P. Bovet and Marco Cesati, O’Reilly, 2005. CSC 660: Advanced Operating Systems 4
![Course Goals 1 A deep understanding of operating system principles 2 A solid grasp Course Goals 1. A deep understanding of operating system principles. 2. A solid grasp](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-5.jpg)
Course Goals 1. A deep understanding of operating system principles. 2. A solid grasp of how the Linux kernel works. 3. An understanding of Linux/POSIX programming interfaces. 4. Ability to read and understand a large base of legacy code. 5. Ability to reliably make modifications to a large code base. CSC 660: Advanced Operating Systems 5
![Grading Grades are based on Individual programming assignments Group projects CSC 660 Grading Grades are based on – Individual programming assignments. – Group projects. CSC 660:](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-6.jpg)
Grading Grades are based on – Individual programming assignments. – Group projects. CSC 660: Advanced Operating Systems A B C D F 90 -100 80 -89 70 -79 60 -69 0 -60 6
![Assignment Policy Available on web page Your responsibility to check for announcements Types of Assignment Policy Available on web page. Your responsibility to check for announcements. Types of](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-7.jpg)
Assignment Policy Available on web page. Your responsibility to check for announcements. Types of assignments Individual programming assignments. Group programming assignments. Late policy 20% penalty up to one week late 0 points given after one week late Submission format E-mail tar archive to waldenj@nku. edu. Tar archive must be named username-as#. tar CSC 660: Advanced Operating Systems 7
![Topics A first look at four important questions What is the kernel Topics A first look at four important questions: – What is the kernel? –](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-8.jpg)
Topics A first look at four important questions: – What is the kernel? – What can we learn about a running kernel? – How is the kernel source structured? – How do we build the kernel? In lab, you’ll get an introduction to – The virtual development environment (Debian Linux under VMWare Player) – Building the kernel. CSC 660: Advanced Operating Systems 8
![What is an OS kernel Program that is always running Manages resources What is an OS kernel? Program that is always running. – Manages resources. –](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-9.jpg)
What is an OS kernel? Program that is always running. – Manages resources. – Provides services. Layering – Layer between programs and hardware. – Layer between users (multiuser OS). – Layer between programs (multitasking OS). CSC 660: Advanced Operating Systems 9
![What is an OS kernel CSC 660 Advanced Operating Systems 10 What is an OS kernel? CSC 660: Advanced Operating Systems 10](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-10.jpg)
What is an OS kernel? CSC 660: Advanced Operating Systems 10
![Resource Management Allocation Allocates finite resources among competing processes CPU memory disk network Protection Resource Management Allocation Allocates finite resources among competing processes. CPU, memory, disk, network Protection](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-11.jpg)
Resource Management Allocation Allocates finite resources among competing processes. CPU, memory, disk, network Protection Prevents processes from interfering with each other. Reclamation Voluntary at runtime; automatic at termination. Virtualization Provides illusion of private unshared resources Timeshared CPU, Virtual Memory, Virtual Machines CSC 660: Advanced Operating Systems 11
![What is the Linux kernel Free open source UNIXcompatible kernel Created by Linus Torvalds What is the Linux kernel? Free open source UNIX-compatible kernel. Created by Linus Torvalds.](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-12.jpg)
What is the Linux kernel? Free open source UNIX-compatible kernel. Created by Linus Torvalds. Developed by thousands across the world. Coordinated via linux-kernel mailing list. CSC 660: Advanced Operating Systems 12
![Kernel History 0 01 1 0 1 2 2 0 2 2 2 4 Kernel History 0. 01 1. 0 1. 2 2. 0 2. 2 2. 4](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-13.jpg)
Kernel History 0. 01 1. 0 1. 2 2. 0 2. 2 2. 4 2. 6 First version released by Linus (1991). First release (x 86 only) in 1994. Supports other CPUs (Alpha, MIPS) in 1995. SMP support, more architectures (1996). Efficient SMP, more hardware support (1999). LVM, Plug-n-Play, USB, etc. (2001). Scalability (embedded, NUMA, PAE, sched), kernel pre-emption, User-mode linux (2003). CSC 660: Advanced Operating Systems 13
![Version Numbering A B C D A Major version Changed twice 1 0 1994 Version Numbering: A. B. C. D A: Major version Changed twice: 1. 0 (1994),](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-14.jpg)
Version Numbering: A. B. C. D A: Major version Changed twice: 1. 0 (1994), 2. 0 (1996) B: Minor version Even numbers are stable releases Odd numbers are development releases C: Minor revision Not so minor in 2. 6 as development continues. D: Bug-fix / security patch release First occurred with NFS bug in 2. 6. 8. 1 Official policy as of 2. 6. 11 CSC 660: Advanced Operating Systems 14
![Kernel Versions mm Andrew Morton tree New patches almost ready for distribution ac Alan Kernel Versions mm: Andrew Morton tree New patches, almost ready for distribution. ac: Alan](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-15.jpg)
Kernel Versions mm: Andrew Morton tree New patches, almost ready for distribution. ac: Alan Cox tree Distribution trees Red. Hat Mandrake Debian Gentoo, etc. CSC 660: Advanced Operating Systems 15
![Identifying the Running Kernel uname Linux uname r 2 6 10 Identifying the Running Kernel > uname Linux > uname -r 2. 6. 10 >](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-16.jpg)
Identifying the Running Kernel > uname Linux > uname -r 2. 6. 10 > cat /proc/version Linux version 2. 6. 10(jw@csc 660) (gcc version 3. 3. 5) #3 Sun Dec 25 10: 22: 50 EST 2005 CSC 660: Advanced Operating Systems 16
![Investigating the Running Kernel proc directory for each running process cpuinfo processor information Investigating the Running Kernel: /proc ###: directory for each running process cpuinfo: processor information](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-17.jpg)
Investigating the Running Kernel: /proc ###: directory for each running process cpuinfo: processor information devices: supported hardware diskstats: disk performance statistics meminfo: memory usage information modules: linux kernel modules net: directory of network information partitions: linux disk partitions swaps: swap files/partitions in use by kernel self: link to ### directory for current process CSC 660: Advanced Operating Systems 17
![Process information ls al F procself drxrxrx 2 jw jw 0 r 1 Process information > ls -al. F /proc/self dr-xr-xr-x 2 jw jw 0 -r---- 1](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-18.jpg)
Process information > ls -al. F /proc/self dr-xr-xr-x 2 jw jw 0 -r---- 1 jw jw 0 -r--r--r-- 1 jw jw 0 lrwxrwxrwx 1 jw jw 0 -r---- 1 jw jw 0 lrwxrwxrwx 1 jw jw 0 dr-x------ 2 jw jw 0 -r--r--r-- 1 jw jw 0 -rw------- 1 jw jw 0 -r--r--r-- 1 jw jw 0 lrwxrwxrwx 1 jw jw 0 -r--r--r-- 1 jw jw 0 dr-xr-xr-x 3 jw jw 0 -r--r--r-- 1 jw jw 0 2005 -12 -29 2005 -12 -29 2005 -12 -29 2005 -12 -29 13: 46 13: 46 13: 46 13: 46 CSC 660: Advanced Operating Systems attr/ auxv cmdline cwd -> /proc/20041/ environ exe -> /bin/bash* fd/ maps mem mounts root -> // statm status task/ wchan 18
![Process information cd procself cat cmdline echo bash cat environ Process information > cd /proc/self > cat cmdline ; echo -bash > cat environ](https://slidetodoc.com/presentation_image/39ef164e21b9a5342647ddd04acabe50/image-19.jpg)
Process information > cd /proc/self > cat cmdline ; echo -bash > cat environ | tr '