The document discusses key concepts related to process management in Linux, including process lifecycle, states, memory segments, scheduling, and priorities. It explains that a process goes through creation, execution, termination, and removal phases repeatedly. Process states include running, stopped, interruptible, uninterruptible, and zombie. Process memory is made up of text, data, BSS, heap, and stack segments. Linux uses a O(1) CPU scheduling algorithm that scales well with process and processor counts.
A File Structure should be according to a required format that the operating system can understand.
A file has a certain defined structure according to its type.
A text file is a sequence of characters organized into lines.
A source file is a sequence of procedures and functions.
An object file is a sequence of bytes organized into blocks that are understandable by the machine.
File Type
File type refers to the ability of the operating system to distinguish different types of file such as text files source files and binary files etc. Many operating systems support many types of files. Operating system like MS-DOS and UNIX have the following types of files −
Ordinary files
These are the files that contain user information.
These may have text, databases or executable program.
The user can apply various operations on such files like add, modify, delete or even remove the entire file.
Directory files
These files contain list of file names and other information related to these files.
Special files
These files are also known as device files.
These files represent physical device like disks, terminals, printers, networks, tape drive etc.
This presentation covers the understanding of system calls for various resource management and covers system calls for file management in details. The understanding of using system calls helps to start with working with device driver programming on Unix/Linux OS.
A File Structure should be according to a required format that the operating system can understand.
A file has a certain defined structure according to its type.
A text file is a sequence of characters organized into lines.
A source file is a sequence of procedures and functions.
An object file is a sequence of bytes organized into blocks that are understandable by the machine.
File Type
File type refers to the ability of the operating system to distinguish different types of file such as text files source files and binary files etc. Many operating systems support many types of files. Operating system like MS-DOS and UNIX have the following types of files −
Ordinary files
These are the files that contain user information.
These may have text, databases or executable program.
The user can apply various operations on such files like add, modify, delete or even remove the entire file.
Directory files
These files contain list of file names and other information related to these files.
Special files
These files are also known as device files.
These files represent physical device like disks, terminals, printers, networks, tape drive etc.
This presentation covers the understanding of system calls for various resource management and covers system calls for file management in details. The understanding of using system calls helps to start with working with device driver programming on Unix/Linux OS.
Gives an overview about Process, PCB, Process States, Process Operations, Scheduling, Schedulers, Interprocess communication, shared memory and message passing systems
Linux Memory Management
1.Memory Structure of Linux OS.
2.How Program is loaded into the memory.
3.Address Translation.
4.Feature for Multithreading and Multiprocessing.
This is the presentation I gave on Linux kernel modules at the Linux Meetup in Austin, TX, on 2/5/2015.
http://www.meetup.com/linux-85/events/185946802/
Code referred to in the presentation: https://github.com/ereyes01/kernel-mod-prez
Gives an overview about Process, PCB, Process States, Process Operations, Scheduling, Schedulers, Interprocess communication, shared memory and message passing systems
Linux Memory Management
1.Memory Structure of Linux OS.
2.How Program is loaded into the memory.
3.Address Translation.
4.Feature for Multithreading and Multiprocessing.
This is the presentation I gave on Linux kernel modules at the Linux Meetup in Austin, TX, on 2/5/2015.
http://www.meetup.com/linux-85/events/185946802/
Code referred to in the presentation: https://github.com/ereyes01/kernel-mod-prez
Week 11
Linux Internals
Processes, scheduling
Lecture organization
Kernel Structure
Process structure
Process creation
Signals
Process management, scheduling
Linux for embedded systems
References
Linux Internals (to the power of -1)
Simone Demblon, Sebastian Spitzner
http://www.tutorialized.com/view/tutorial/Linux-kernel-internals-from-Process-Birth-to-Death/40955
Linux Knowledge Base and Tutorial
http://linux-tutorial.info/modules.php?name=MContent&pageid=224
Inside the Linux scheduler IBM Developer Works
http://www.ibm.com/developerworks/linux/library/l-scheduler/
The Linux Kernel
A Unix kernel fulfills 4 main management tasks:
• Memory management
• Process management
• File system management
• IO management
For our study of real time implications, we will examine Process management
A Rather brief look at the kernel
Part 1
Process structure
Process data structure
A process is represented by a rather large structure called task_struct.
It contains all of the necessary data to represent the process, along with data for accounting and to maintain relationships with other processes (parents and children).
The actual structure of the task_struct is many pages long
A short sample of task_struct is shown in the next slide
Task_struct
Pointers to open files
Memory map
Signals: received, masked
Register contents
Everything defining the state of the computation
Task_struct detail
The sample contains the state of execution, a stack, a set of flags, the parent process, the thread of execution (of which there can be many), and open files.
The state variable: the state of the task.
Typical states:
the process is running
In a run queue about to be running (TASK_RUNNING),
sleeping (TASK_INTERRUPTIBLE),
sleeping but unable to be woken up (TASK_UNINTERRUPTIBLE),
stopped (TASK_STOPPED), or a few others.
Flags: the process is being created (PF_STARTING) or exiting (PF_EXITING), or currently allocating memory (PF_MEMALLOC).
The comm (command) field: the name of the executable
Priority: (called static_prio). The actual priority is determined dynamically based on loading and other factors.
More Task_struct
The tasks field is a linked-list
mm and active_mm fields The process's address space. mm represents the process's memory descriptors, while the active_mm is the previous process's memory descriptors
The thread_struct identifies the stored state of the process: The CPU state (hardware registers, program counter, etc.).
Part 2
Process creation
System call functions
user-space tasks and kernel tasks, rely on a function called do_fork to create the new process.
In the case of creating a kernel thread, the kernel calls a function called kernel_thread
In user-space, a program calls fork, which results in a system call to the kernel function called sys_fork
The function relationships are shown graphically in the next slide.
Function hierarchy for process creation
do_fork
The do_fork f.
Operating system - Process and its conceptsKaran Thakkar
This presentation gives an overview of Process concepts in Operating System. The presentation aims at alleviating most of the overheads while understanding the process concept in operating system. this tailor made presentation will help individuals to understand the overall meaning of process and its underlying concepts used in an operating system.
OS | Functions of OS | Operations of OS | Operations of a process | Scheduling algorithms | FCFS scheduling | SJF scheduling | RR scheduling | Paging | File system implementation | Cryptography as a security tool
Concept of processes, process scheduling, operations on processes, inter-process communication,
communication in Client-Server-Systems, overview & benefits of threads.
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxEduSkills OECD
Andreas Schleicher presents at the OECD webinar ‘Digital devices in schools: detrimental distraction or secret to success?’ on 27 May 2024. The presentation was based on findings from PISA 2022 results and the webinar helped launch the PISA in Focus ‘Managing screen time: How to protect and equip students against distraction’ https://www.oecd-ilibrary.org/education/managing-screen-time_7c225af4-en and the OECD Education Policy Perspective ‘Students, digital devices and success’ can be found here - https://oe.cd/il/5yV
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
Model Attribute Check Company Auto PropertyCeline George
In Odoo, the multi-company feature allows you to manage multiple companies within a single Odoo database instance. Each company can have its own configurations while still sharing common resources such as products, customers, and suppliers.
The Indian economy is classified into different sectors to simplify the analysis and understanding of economic activities. For Class 10, it's essential to grasp the sectors of the Indian economy, understand their characteristics, and recognize their importance. This guide will provide detailed notes on the Sectors of the Indian Economy Class 10, using specific long-tail keywords to enhance comprehension.
For more information, visit-www.vavaclasses.com
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
In this webinar you will learn how your organization can access TechSoup's wide variety of product discount and donation programs. From hardware to software, we'll give you a tour of the tools available to help your nonprofit with productivity, collaboration, financial management, donor tracking, security, and more.
The Art Pastor's Guide to Sabbath | Steve ThomasonSteve Thomason
What is the purpose of the Sabbath Law in the Torah. It is interesting to compare how the context of the law shifts from Exodus to Deuteronomy. Who gets to rest, and why?
How to Split Bills in the Odoo 17 POS ModuleCeline George
Bills have a main role in point of sale procedure. It will help to track sales, handling payments and giving receipts to customers. Bill splitting also has an important role in POS. For example, If some friends come together for dinner and if they want to divide the bill then it is possible by POS bill splitting. This slide will show how to split bills in odoo 17 POS.
2. PERFORMANCE TUNING
Performance tuning is a challenging task that requires in-depth
understanding of the hardware, operating system, and application.
3. LINUX PROCESS MANAGEMENT
Process management is one of the most important roles of any
operating system.
Linux process management implementation is similar to UNIX®
implementation. It includes process scheduling, interrupt handling,
signaling, process prioritization, process switching, process state,
process memory, and so on.
4. WHAT IS A PROCESS
A process is an instance of execution that runs on a processor. The
process uses any resources that the Linux kernel can handle to
complete its task.
5. LIFE CYCLE OF A PROCESS
Every process has its own life cycle such as creation, execution,
termination, and removal. These phases will be repeated literally
millions of times as long as the system is up and running. Therefore,
the process life cycle is very important from the performance
perspective.
6. LIFE CYCLE OF A PROCESS
When a process creates a new process, the creating process (parent
process) issues a fork() system call. When a fork() system call is
issued, it gets a process descriptor for the newly created process
(child process) and sets a new process id. It copies the values of the
parent process’ process descriptor to the child’s. At this time the
entire address space of the parent process is not copied; both
processes share the same address space.
7. LIFE CYCLE OF A PROCESS
The exec() system call copies the new program to the address space
of the child process. Because both processes share the same address
space, writing new program data causes a page fault exception. At
this point, the kernel assigns the new physical page to the child
process.
8. LIFE CYCLE OF A PROCESS
When program execution has completed, the child process terminates
with an exit() system call. The exit() system call releases most of the
data structure of the process and notifies the parent process of the
termination sending a signal
9. LIFE CYCLE OF A PROCESS
The child process will not be completely removed until the parent
process knows of the termination of its child process by the wait()
system call. As soon as the parent process is notified of the child
process termination, it removes all the data structure of the child
process and release the process descriptor.
10. THREAD
A thread is an execution unit generated in a single process. It runs
parallel with other threads in the same process. They can share the
same resources such as memory, address space, open files, and so
on. They can access the same set of application data. A thread is also
called Light Weight Process (LWP). Because they share resources, each
thread should not change their shared resources at the same time.
The implementation of mutual exclusion, locking, serialization, and so
on, are the user application’s responsibility
11. PROCESS PRIORITY AND NICE
LEVEL
Process priority is a number that determines the order in which the
process is handled by the CPU and is determined by dynamic priority
and static priority.
A process which has higher process priority has a greater chance of
getting permission to run on a processor.
12. CONTEXT SWITCHING
During process execution, information on the running process is stored in
registers on the
processor and its cache. The set of data that is loaded to the register for the
executing
process is called the context. To switch processes, the context of the
running process is
stored and the context of the next running process is restored to the
register. The process
descriptor and the area called kernel mode stack are used to store the
context. This switching
process is called context switching. Having too much context switching is
undesirable
because the processor has to flush its register and cache every time to make
13. INTERRUPT HANDLING
Interrupt handling is one of the highest priority tasks. Interrupts are usually
generated by I/O
devices such as a network interface card, keyboard, disk controller, serial
adapter, and so on.
The interrupt handler notifies the Linux kernel of an event (such as keyboard
input, ethernet
frame arrival, and so on). It tells the kernel to interrupt process execution
and perform
interrupt handling as quickly as possible because some device requires quick
responsiveness. This is critical for system stability. When an interrupt signal
arrives to the
kernel, the kernel must switch a current execution process to a new one to
handle the
14. In Linux implementations, there are two types of interrupts. A hard
interrupt is generated for devices which require responsiveness (disk
I/O interrupt, network adapter interrupt, keyboard interrupt, mouse
interrupt).
A soft interrupt is used for tasks which processing can be deferred
(TCP/IP operation, SCSI protocol operation, and so on). You can see
information related to hard interrupts at /proc/interrupts.
15. PROCESS STATE
Every process has its own state that shows what is currently happening in
the process.
Process state changes during process execution. Some of the possible states
are as follows:
TASK_RUNNING
In this state, a process is running on a CPU or waiting to run in the queue
(run queue).
TASK_STOPPED
A process suspended by certain signals (for example SIGINT, SIGSTOP) is in
this state. The
process is waiting to be resumed by a signal such as SIGCONT.
TASK_INTERRUPTIBLE
16. In this state, the process is suspended and waits for a certain condition to be
satisfied. If a process is in TASK_INTERRUPTIBLE state and it receives a signal to
stop, the process state is changed and operation will be interrupted. A typical
example of a
TASK_INTERRUPTIBLE process is a process waiting for keyboard interrupt.
TASK_UNINTERRUPTIBLE
Similar to TASK_INTERRUPTIBLE. While a process in TASK_INTERRUPTIBLE state
can be interrupted, sending a signal does nothing to the process in
TASK_UNINTERRUPTIBLE state. A typical example of a TASK_UNINTERRUPTIBLE
process is a process waiting for disk I/O operation.
TASK_ZOMBIE
After a process exits with exit() system call, its parent should know of the
termination. In TASK_ZOMBIE state, a process is waiting for its parent to be
notified to release all the data structure.
17. ZOMBIE PROCESSES
When a process has already terminated, having received a signal to
do so, it normally takes some time to finish all tasks (such as closing
open files) before ending itself. In that normally very short time
frame, the process is a zombie.
18. PROCESS MEMORY SEGMENTS
A process uses its own memory area to perform work. The work
varies depending on the situation and process usage. A process can
have different workload characteristics and different data size
requirements. The process has to handle a of variety of data sizes. To
satisfy this requirement, the Linux kernel uses a dynamic memory
allocation mechanism for each process.
19. The process memory area consist of these segments
Text segment
The area where executable code is stored.
Data segment
The data segment consists of these three areas.
– Data: The area where initialized data such as static variables are stored.
– BSS: The area where zero-initialized data is stored. The data is initialized to zero.
– Heap: The area where malloc() allocates dynamic memory based on the demand.
The heap grows towards higher addresses.
Stack segment
The area where local variables, function parameters, and the return address of a function
is stored. The stack grows toward lower addresses.
20. LINUX CPU SCHEDULER
The basic functionality of any computer is, quite simply, to compute. To be able to
compute,
there must be a means to manage the computing resources, or processors, and the
computing tasks, also known as threads or processes. Thanks to the great work of Ingo
Molnar, Linux features a kernel using a O(1) algorithm as opposed to the O(n) algorithm
used
to describe the former CPU scheduler. The term O(1) refers to a static algorithm, meaning
that the time taken to choose a process for placing into execution is constant, regardless
of
the number of processes.
The new scheduler scales very well, regardless of process count or processor count, and
imposes a low overhead on the system. The algorithm uses two process priority arrays:
1. active
2. expired