1 / 15

Linux Kernel introduction

Linux Kernel introduction. COSC 513 Xiaoping Yang. What is Linux. A clone of Unix operating system Provides for the efficient management of system resources: Linux is almost a freeware First developed for 32-bit x86-based PCs (386 or higher). Three major components: Kernel

denis
Download Presentation

Linux Kernel introduction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Linux Kernel introduction COSC 513 Xiaoping Yang

  2. What is Linux • A clone of Unix operating system • Provides for the efficient management of system resources: • Linux is almost a freeware • First developed for 32-bit x86-based PCs (386 or higher). • Three major components: • Kernel • Shell Environment • File structure

  3. What is the Linux Kernel? • The Heart of the Linux Operating System • Provides for the efficient management of system resources: • CPU • Interprocess Communication • Memory • Devices: • Disks • Terminals • Networks • Printers

  4. What inside Linux Kernel Linux Kernel is a monolithic kernel • Linux kernel Kernel contains: • System Call interface • Memory Manager • File System • Network support

  5. Linux Processes and Tasks • Linux Process = Executing Program Linux Task is a generalization of a Thread • Single threaded process is represented as a task • Multi-threaded process is multiple tasks • Only visible to the programmer and the kernel. • The Scheduler decides which task(s) gets to use the CPU(s)

  6. Linux Scheduler • Multi-level queue scheduler • Three queues • SCHED_FIFO - standard priority. • Highest priority. • No time-slice • "supervisor" processes only • SCHED_RR - priority round robin. • Highest priority RR runs for 1 time slice. • "supervisor" processes only • SCHED_OTHER - time-sharing • All Linux user processes

  7. Process Tree • There is a tree like relationship among processes: Given the following: • $ netscape & • $ emacs & • $ xfig & • bash is the parent process • netscape, emacs and xfig are children of bash and are siblings • netscape is the oldest sibling • xfig is the youngest sibling • Linux stores this structure as linked lists • Linux will show you the tree (using ps f )

  8. Process Tree (cont.)

  9. Task Tree • For every task the kernel maintains a task_struct task_struct contains all relevant information about a task. • General: • PID,Program name • Parent, youngest child, next sibling, previous sibling • Process Times (start_time, utime, stime, cutime, cstime) • Scheduling algorithm, priority, nice value, errno • Process state • Owner: • UID • GID

  10. Task tree (Cont.) • Files: • Information on all files opened by the process. • Stored in the fs_struct sub-structure • Memory: • Information about the memory used by a process. • IPC / Synchronization: • Pointers to acquired Semaphores • Bitmask of received Signals and associated Signal handlers • Some other stuff... • Linux stores all task_structs in a doubly linked list.

  11. Linux Process State

  12. Interrupts and System Calls • An interrupt is a request from the hardware for immediate attention. • Two types of interrupts in Linux: • Fast Interrupts • Suspend current task, process interrupt, resume task • All other interrupts are generally disabled • Keyboard interrupt • Mouse interrupt

  13. Interrupts and System Calls (cont.) • Slow Interrupts • All registers are saved. • Only interrupts of same type are disabled. • Scheduler is called when ISR exits. • Timer interrupt • Disk Drive interrupt • System calls

  14. Fast Interrupts in Linux • Suspend current task • Save CPU registers that might be altered • Switch CPU to kernel (system/supervisor/etc...) mode • Block all interrupts • Call Interrupt Service Routine (ISR) • Unblock interrupts • Switch CPU to user mode • Resume suspended task • Restore saved CPU Registers

  15. END

More Related