24

4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING 2007-2008 SUSE Lab

Embed Size (px)

Citation preview

Page 1: 4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING 2007-2008 SUSE Lab
Page 2: 4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING 2007-2008 SUSE Lab

4300 Lines Added1800 Lines Removed1500 Lines Modified

PER DAY DURING 2007-2008SUSE Lab

Page 3: 4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING 2007-2008 SUSE Lab
Page 4: 4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING 2007-2008 SUSE Lab
Page 5: 4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING 2007-2008 SUSE Lab

• The kernel is the "core" of any computer system: it is the "software" which allows users to share computer resources.

• XWindow environment doesn't belong to the Linux Kernel

Page 6: 4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING 2007-2008 SUSE Lab

• avoid crash, OS designed with 2 different operative modes: – Kernel Mode: the machine operates with critical data structure, direct hardware (IN/OUT or

memory mapped), direct memory, IRQ, DMA, and so on.– User Mode: users can run applications.

• Kernel Mode "prevents" User Mode applications from damaging the system or its features.

Page 7: 4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING 2007-2008 SUSE Lab
Page 8: 4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING 2007-2008 SUSE Lab

• When calling a System Call: after calling a System Call, the task voluntary calls pieces of code living in Kernel Mode

• When an IRQ (or exception) comes: after the IRQ an IRQ handler (or exception handler) is called, then control returns back to the task that was interrupted like nothing was happened.

Page 9: 4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING 2007-2008 SUSE Lab

• System calls are like special functions that manage OS routines which live in Kernel Mode.• A system call can be called when we:

– access an I/O device or a file (like read or write)– need to access privileged information (like pid, changing scheduling policy or other information)– need to change execution context (like forking or executing some other application) – need to execute a particular command (like ''chdir'', ''kill", ''brk'', or ''signal'')

Page 10: 4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING 2007-2008 SUSE Lab

• When an IRQ comes, the task that is running is interrupted in order to service the IRQ Handler.

• After the IRQ is handled, control returns backs exactly to point of interrupt

Page 11: 4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING 2007-2008 SUSE Lab

• The concept of a process is fundamental to any multiprogramming operating system.

• A process is usually defined as an instance of a program in execution• Process Descriptor

Page 12: 4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING 2007-2008 SUSE Lab

• TASK_RUNNING • TASK_INTERRUPTIBLE • TASK_UNINTERRUPTIBLE • TASK_STOPPED • TASK_ZOMBIE – Process execution is terminated, but the parent

process has not yet issued a wait( ) to return information about the dead process.

Page 13: 4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING 2007-2008 SUSE Lab

• Identifying a Process – lightweight processes—each process has its own

process Descriptor

• Process ID– The PID is a 32-bit unsigned integer stored in the pid field of the process descriptor.

– kill( ) use the PID

Page 14: 4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING 2007-2008 SUSE Lab

Linux stores two different data structures for each process in a single 8 KB memory area the process descriptor and the Kernel Mode process stack.The process descriptor starts from the beginning of the memory area and the stack from the end.

Page 15: 4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING 2007-2008 SUSE Lab

• circular doubly linked list

• Hash Table

Page 16: 4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING 2007-2008 SUSE Lab

• p_opptr (original parent) • p_pptr (parent) • p_cptr (child) • p_ysptr (younger sibling) • p_osptr (older sibling)

Page 17: 4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING 2007-2008 SUSE Lab

• In order to control the execution of processes, the kernel must be able to suspend the execution of the process running on the CPU and resume the execution of some other process previously suspended. This activity is called process switching , task switching, or context switching. – Hardware context – Hardware support – Linux code – Saving the floating point registers

Page 18: 4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING 2007-2008 SUSE Lab

• The clone( ), fork( ), and vfork( ) System Calls • Kernel Threads– kernel_thread( )

• Destroying Processes – exit( )– All process terminations are handled by the do_exit( ) function– Wait()– The release( ) function releases the process descriptor of a

zombie process

Page 19: 4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING 2007-2008 SUSE Lab

• On Linux, kernel threads are created with the clone system call. This system call is similar to fork in that it creates a task which is executing the current program. However it differs in that clone specifies which resources should be shared. To create a thread, we call clone to create a task which shares as much as possible: The memory space, file descriptors and signal handlers. The signal to be sent when the thread exists is SIGCHLD so wait will return when a thread exits.

Page 20: 4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING 2007-2008 SUSE Lab

• A signal is a very short message that may be sent to a process or to a group of processes.

• Signals serve two main purposes: – To make a process aware that a specific event has occurred – To force a process to execute a signal handler function included

in its code

Page 21: 4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING 2007-2008 SUSE Lab
Page 22: 4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING 2007-2008 SUSE Lab

• Linux scheduling is based on – time-sharing technique• Quantum slice

– ranking processes• Priority

• Interactive processes • Batch processes • Real-time processes

Page 23: 4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING 2007-2008 SUSE Lab
Page 24: 4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING 2007-2008 SUSE Lab