Download presentation
Presentation is loading. Please wait.
Published byLiliana Kelly Modified over 9 years ago
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 Kernel contains: System Call interface Memory Manager File System Network support Linux Kernel is a monolithic kernel
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)Scheduler
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 fs_struct Memory: Information about the memory used by a process.memory IPC / Synchronization: Pointers to acquired Semaphores Bitmask of received Signals and associated Signal handlersSignals 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 Fast Interrupts Suspend current task, process interrupt, resume task All other interrupts are generally disabled Keyboard interrupt Mouse interrupt
13
Slow Interrupts 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 Interrupts and System Calls (cont.)
14
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 Fast Interrupts in Linux
15
END
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.