SlideShare a Scribd company logo
1 of 16
Managing Processes in Unix
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
Process:-
Process can be defined as a program under Execution . Unix runs many programs
at the Same time by using Round-robin Scheduling algorithm
Shell creates a process for executing the cat command.
The shell process(sh) is a parent process and the cat process is a child process . As
long as process is Running , it is alive. After completing the job , it be comes in
active and is said to be dead.
Parent and child process:-
 In Unix one process can generate another process.The process which generates
another process is Called Parent process. Newly generated process is called
child process.
 The parent can have one or more children
Eg:-$cat fruits|grep orange fruits
 The shell creates two child process cat and grep simultaneously.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
Unix process creation:-
★ Parent is the original process.
★new process is called child.
★child cantains same code , same data of its parent.
★the parent can either wait for child to complete , or continue executing in
parallel with the child.
★child is created by system call fork().
★fork()returns 0(zero)in child process.
★fork()returns PID of new child in parent process.
★fork()system call is not successful , it returns-1.
★Resource sharing: a process needs certain resource like CPU time , Memory, I/O
devices etc.
★exec()system call is used after fork(),to start another different program.
★ps command is used display a listing of currently active processes in the system.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
 A process means program in execution. It generally takes an input, processes
it and gives us the appropriate output. Check Introduction to Process
Management for more details about a process.
 There are basically 2 types of processes.
 Foreground processes: Such kind of processes are also known as interactive
processes. These are the processes which are to be executed or initiated by the
user or the programmer, they can not be initialized by system services. Such
processes take input from the user and return the output. While these
processes are running we can not directly initiate a new process from the same
terminal.
 Background processes: Such kind of processes are also known as non
interactive processes. These are the processes that are to be executed or
initiated by the system itself or by users, though they can even be managed by
users. These processes have a unique PID or process if assigned to them and we
can initiate other processes within the same terminal from which they are
initiated.

Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
Process States in UNIX:
The lifetime of a process can be conceptually divided into 9 states.
1. User Running: The process is executing in user-mode.
2. Kernel Running: The process is executing in the kernel-mode.
3. Ready to run: The process isn’t executing, but it is ready to run as soon as the
kernel schedules it.
4. Asleep: The process is sleeping and resides in the main memory.
5. Ready to run, Swapped: The process is ready to run, but the swapper must
swap the process into the main memory before the kernel can schedule it to
execute.
6. Sleeping, Swapped: The process is sleeping, and the swapper has swapped the
process to secondary storage to make room for other processes in the main
memory.
7. Preempted: The process is returning from the kernel to user mode but the
kernel preempts it and it does a context switch to schedule another process.
8. Created: The process is newly created and not yet ready to run.
9. Zombie: The process no longer exists, but it leaves a record for its parent
process to collect.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
Parent and Child Processes
 Each unix process has two ID numbers assigned to it: The Process ID (pid) and
the Parent process ID (ppid). Each user process in the system has a parent
process.
 Most of the commands that you run have the shell as their parent. Check the ps
-f example where this command listed both the process ID and the parent
process ID.
Zombie and Orphan Processes
 Normally, when a child process is killed, the parent process is updated via
a SIGCHLD signal. Then the parent can do some other task or restart a new
child as needed. However, sometimes the parent process is killed before its
child is killed. In this case, the "parent of all processes," the init process,
becomes the new PPID (parent process ID). In some cases, these processes are
called orphan processes.
 When a process is killed, a ps listing may still show the process with a Z state.
This is a zombie or defunct process. The process is dead and not being used.
These processes are different from the orphan processes. They have completed
execution but still find an entry in the process table.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
Daemon Processes
 Daemons are system-related background processes that often run with the
permissions of root and services requests from other processes.
 A daemon has no controlling terminal. It cannot open /dev/tty. If you do a "ps
-ef" and look at the tty field, all daemons will have a ? for the tty.
 To be precise, a daemon is a process that runs in the background, usually
waiting for something to happen that it is capable of working with. For
example, a printer daemon waiting for print commands.
 If you have a program that calls for lengthy processing, then it’s worth to make
it a daemon and run it in the background.
The top Command
 The top command is a very useful tool for quickly showing processes sorted by
various criteria.
 It is an interactive diagnostic tool that updates frequently and shows
information about physical and virtual memory, CPU usage, load averages, and
your busy processes.
 Here is the simple syntax to run top command and to see the statistics of CPU
utilization by different processes −$top
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
Job ID Versus Process ID
 Background and suspended processes are usually manipulated via job number
(job ID). This number is different from the process ID and is used because it is
shorter.
 In addition, a job can consist of multiple processes running in a series or at the
same time, in parallel. Using the job ID is easier than tracking individual
processes.
Nice command:-
 It is used to change or set the priority of a process
 syntax: $nice-value cat filename
 The default priority of a process in unix is 20
 The value range from 0 to 39, in linux-9 to 20.where 0 is high and 39 is lower
value.
 the default value of reduction is 10.
 The priority of a process can be increased only by administrator using double
minus(--).
 eg:-$nice--15catlast.txt
 The priority of a process can be made lower using the nice command.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
For example: if a process is already running and using a lot of cpu time ; then it
can be reniced.
 i.e.$nicecatlast.txt
 $nice-10catlast.txt
 $nice--15catlast.txt
Process Termination:-
There are situations when the user has to terminate a process prematurely. Several
reasons are
Possible for process termination such as:
★The terminal hangs.
★user logs off.
★Program execution has gone into endless loop.
★ Error and fault conditions.
★Time lim
★ Memory unavailable it exceeded.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
★I/O failure.
★Data misuse.
★system performance slow due to too many background processes running.
★Operating system intervention(for example to resolve , adeadlock).When a
UNIX process is terminated normally , it
★Close all files.
★save usage status.
★Makes init process the parent of live children.
★Changes run state to zombie.
Communication commands:-
1)Kill command : Termination of a process forcibly is called killing.
 Background process can be terminated by using kill command.
 A foreground process is terminated using del key or break key.
 PID is used to select the process.
 Syntax:-$kill PID.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
 More than one process can be killed using a single kill
command.
 A special variable$!(That holds PID of last background process)
 Used to killl last background process.
 A special variable $$(That holds PID of current shell)used to kill current shell.
 $kill 0:to terminate all process of a user.
 $kill -90:to terminate all process of a user including the login shell.
2)mesg command:-is used to change the write permission of a user.
 Syntax:-$mesg y #grant the write permission.
 $mesg n #denise the write permission.
 $mes g #current write status.
 If user doesn't want to be disturbed , he can deny the write permission.
 But super can send message irrespective of permission.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
3)Write command: allows two way communication between two users
Who are currently logged in and have given write permission.
Syntax:-$write username
 The user A can send messages to user B who is logged in.
 Then user B get message with a beep sound , then B replies.
 But both the users must be logged in.
4)Finger command:-is similar to who command , it shows current login
details and shows asterisk symbol for those who have permission to accept
messages.
Syntax:-$finger
5)wall command:-wall stands for write all. wall command is used only by
the super user to send messages to all users on the system.It is also known as
broadcasting a message to all users , irrespective of there permissions.
Syntax:-$wal
Fg
 You can use the command “fg” to continue a program which was stopped and
bring it to the foreground.
 The simple syntax for this utility is:
e.g:fg jobname
Top
 This utility tells the user about all the running processes on the Linux machine.
PS
 This command stands for ‘Process Status’. It is similar to the “Task Manager”
that pop-ups in a Windows Machine when we use Cntrl+Alt+Del. This
command is similar to ‘top’ command but the information displayed is
different.
 To check all the processes running under a user, use the command –
e.g ps ux
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
You can also check the process status of a single process, use the syntax –
 ps P
Kill
 This command terminates running processes on a Linux machine.
 To use these utilities you need to know the PID (process id) of the process you
want to kill
 Syntax –kill PID
To find the PID of a process simply type
 pidof Process name
DF
 This utility reports the free disk space(Hard Disk) on all the file systems.
'df -h'
Free
 This command shows the free and used memory (RAM) on the Linux system.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
Command Description
bg To send a process to the background
fg To run a stopped process in the foreground
top Details on all Active Processes
ps Give the status of processes running for a user
ps PID Gives the status of a particular process
pidof Gives the Process ID (PID) of a process
kill PID Kills a process
nice Starts a process with a given priority
renice Changes priority of an already running process
df Gives free hard disk space on your system
free Gives free RAM on your system
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
Thanks !
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune

More Related Content

Similar to Managing Processes in Unix.pptx

Advanced Operating Systems......Process Management
Advanced Operating Systems......Process ManagementAdvanced Operating Systems......Process Management
Advanced Operating Systems......Process ManagementVeejeya Kumbhar
 
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncationLM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncationMani Deepak Choudhry
 
Ch2_Processes_and_process_management_1.ppt
Ch2_Processes_and_process_management_1.pptCh2_Processes_and_process_management_1.ppt
Ch2_Processes_and_process_management_1.pptMohammad Almuiet
 
UNIT-2-Process-Management.pdf
UNIT-2-Process-Management.pdfUNIT-2-Process-Management.pdf
UNIT-2-Process-Management.pdfaakritii765
 
Operating system
Operating systemOperating system
Operating systemMark Muhama
 
Chapter 1 Introduction to Operating System Concepts
Chapter 1 Introduction to Operating System ConceptsChapter 1 Introduction to Operating System Concepts
Chapter 1 Introduction to Operating System ConceptsMeenalJabde
 
System Administration: Linux Process
System Administration: Linux ProcessSystem Administration: Linux Process
System Administration: Linux Processlucita cabral
 
operating system question bank
operating system question bankoperating system question bank
operating system question bankrajatdeep kaur
 
Chapter two process.pptx
Chapter two process.pptxChapter two process.pptx
Chapter two process.pptxMezigebuMelese1
 
OperatingSystem02..(B.SC Part 2)
OperatingSystem02..(B.SC Part 2)OperatingSystem02..(B.SC Part 2)
OperatingSystem02..(B.SC Part 2)Muhammad Osama
 
Operating Systems Unit Two - Fourth Semester - Engineering
Operating Systems Unit Two - Fourth Semester - EngineeringOperating Systems Unit Two - Fourth Semester - Engineering
Operating Systems Unit Two - Fourth Semester - EngineeringYogesh Santhan
 
operating system for computer engineering ch3.ppt
operating system for computer engineering ch3.pptoperating system for computer engineering ch3.ppt
operating system for computer engineering ch3.pptgezaegebre1
 

Similar to Managing Processes in Unix.pptx (20)

Advanced Operating Systems......Process Management
Advanced Operating Systems......Process ManagementAdvanced Operating Systems......Process Management
Advanced Operating Systems......Process Management
 
Chapter 3.pdf
Chapter 3.pdfChapter 3.pdf
Chapter 3.pdf
 
Process management
Process managementProcess management
Process management
 
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncationLM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
LM9 - OPERATIONS, SCHEDULING, Inter process xommuncation
 
Ch2_Processes_and_process_management_1.ppt
Ch2_Processes_and_process_management_1.pptCh2_Processes_and_process_management_1.ppt
Ch2_Processes_and_process_management_1.ppt
 
UNIT-2-Process-Management.pdf
UNIT-2-Process-Management.pdfUNIT-2-Process-Management.pdf
UNIT-2-Process-Management.pdf
 
OS (1).pptx
OS (1).pptxOS (1).pptx
OS (1).pptx
 
LP-Unit3.docx
LP-Unit3.docxLP-Unit3.docx
LP-Unit3.docx
 
Operating system
Operating systemOperating system
Operating system
 
Operating system
Operating systemOperating system
Operating system
 
Ch03- PROCESSES.ppt
Ch03- PROCESSES.pptCh03- PROCESSES.ppt
Ch03- PROCESSES.ppt
 
Chapter 1 Introduction to Operating System Concepts
Chapter 1 Introduction to Operating System ConceptsChapter 1 Introduction to Operating System Concepts
Chapter 1 Introduction to Operating System Concepts
 
System Administration: Linux Process
System Administration: Linux ProcessSystem Administration: Linux Process
System Administration: Linux Process
 
operating system question bank
operating system question bankoperating system question bank
operating system question bank
 
Chapter two process.pptx
Chapter two process.pptxChapter two process.pptx
Chapter two process.pptx
 
Process threads operating system.
Process threads operating system.Process threads operating system.
Process threads operating system.
 
Os
OsOs
Os
 
OperatingSystem02..(B.SC Part 2)
OperatingSystem02..(B.SC Part 2)OperatingSystem02..(B.SC Part 2)
OperatingSystem02..(B.SC Part 2)
 
Operating Systems Unit Two - Fourth Semester - Engineering
Operating Systems Unit Two - Fourth Semester - EngineeringOperating Systems Unit Two - Fourth Semester - Engineering
Operating Systems Unit Two - Fourth Semester - Engineering
 
operating system for computer engineering ch3.ppt
operating system for computer engineering ch3.pptoperating system for computer engineering ch3.ppt
operating system for computer engineering ch3.ppt
 

More from Harsha Patel

Introduction to Reinforcement Learning.pptx
Introduction to Reinforcement Learning.pptxIntroduction to Reinforcement Learning.pptx
Introduction to Reinforcement Learning.pptxHarsha Patel
 
Introduction to Association Rules.pptx
Introduction  to  Association  Rules.pptxIntroduction  to  Association  Rules.pptx
Introduction to Association Rules.pptxHarsha Patel
 
Introduction to Clustering . pptx
Introduction    to     Clustering . pptxIntroduction    to     Clustering . pptx
Introduction to Clustering . pptxHarsha Patel
 
Introduction to Classification . pptx
Introduction  to   Classification . pptxIntroduction  to   Classification . pptx
Introduction to Classification . pptxHarsha Patel
 
Introduction to Regression . pptx
Introduction     to    Regression . pptxIntroduction     to    Regression . pptx
Introduction to Regression . pptxHarsha Patel
 
Intro of Machine Learning Models .pptx
Intro of Machine  Learning  Models .pptxIntro of Machine  Learning  Models .pptx
Intro of Machine Learning Models .pptxHarsha Patel
 
Introduction to Machine Learning.pptx
Introduction  to  Machine  Learning.pptxIntroduction  to  Machine  Learning.pptx
Introduction to Machine Learning.pptxHarsha Patel
 
Unit-V-Introduction to Data Mining.pptx
Unit-V-Introduction to  Data Mining.pptxUnit-V-Introduction to  Data Mining.pptx
Unit-V-Introduction to Data Mining.pptxHarsha Patel
 
Unit-IV-Introduction to Data Warehousing .pptx
Unit-IV-Introduction to Data Warehousing .pptxUnit-IV-Introduction to Data Warehousing .pptx
Unit-IV-Introduction to Data Warehousing .pptxHarsha Patel
 
Unit-III-AI Search Techniques and solution's
Unit-III-AI Search Techniques and solution'sUnit-III-AI Search Techniques and solution's
Unit-III-AI Search Techniques and solution'sHarsha Patel
 
Unit-II-Introduction of Artifiial Intelligence.pptx
Unit-II-Introduction of Artifiial Intelligence.pptxUnit-II-Introduction of Artifiial Intelligence.pptx
Unit-II-Introduction of Artifiial Intelligence.pptxHarsha Patel
 
Unit-I-Introduction to Recent Trends.pptx
Unit-I-Introduction to Recent Trends.pptxUnit-I-Introduction to Recent Trends.pptx
Unit-I-Introduction to Recent Trends.pptxHarsha Patel
 
Using Unix Commands.pptx
Using Unix Commands.pptxUsing Unix Commands.pptx
Using Unix Commands.pptxHarsha Patel
 
Using Vi Editor.pptx
Using Vi Editor.pptxUsing Vi Editor.pptx
Using Vi Editor.pptxHarsha Patel
 
Shell Scripting and Programming.pptx
Shell Scripting and Programming.pptxShell Scripting and Programming.pptx
Shell Scripting and Programming.pptxHarsha Patel
 
Introduction to Unix Concets.pptx
Introduction to Unix Concets.pptxIntroduction to Unix Concets.pptx
Introduction to Unix Concets.pptxHarsha Patel
 
Handling Files Under Unix.pptx
Handling Files Under Unix.pptxHandling Files Under Unix.pptx
Handling Files Under Unix.pptxHarsha Patel
 
Introduction to OS.pptx
Introduction to OS.pptxIntroduction to OS.pptx
Introduction to OS.pptxHarsha Patel
 
Using Unix Commands.pptx
Using Unix Commands.pptxUsing Unix Commands.pptx
Using Unix Commands.pptxHarsha Patel
 
Introduction to Unix Concets.pptx
Introduction to Unix Concets.pptxIntroduction to Unix Concets.pptx
Introduction to Unix Concets.pptxHarsha Patel
 

More from Harsha Patel (20)

Introduction to Reinforcement Learning.pptx
Introduction to Reinforcement Learning.pptxIntroduction to Reinforcement Learning.pptx
Introduction to Reinforcement Learning.pptx
 
Introduction to Association Rules.pptx
Introduction  to  Association  Rules.pptxIntroduction  to  Association  Rules.pptx
Introduction to Association Rules.pptx
 
Introduction to Clustering . pptx
Introduction    to     Clustering . pptxIntroduction    to     Clustering . pptx
Introduction to Clustering . pptx
 
Introduction to Classification . pptx
Introduction  to   Classification . pptxIntroduction  to   Classification . pptx
Introduction to Classification . pptx
 
Introduction to Regression . pptx
Introduction     to    Regression . pptxIntroduction     to    Regression . pptx
Introduction to Regression . pptx
 
Intro of Machine Learning Models .pptx
Intro of Machine  Learning  Models .pptxIntro of Machine  Learning  Models .pptx
Intro of Machine Learning Models .pptx
 
Introduction to Machine Learning.pptx
Introduction  to  Machine  Learning.pptxIntroduction  to  Machine  Learning.pptx
Introduction to Machine Learning.pptx
 
Unit-V-Introduction to Data Mining.pptx
Unit-V-Introduction to  Data Mining.pptxUnit-V-Introduction to  Data Mining.pptx
Unit-V-Introduction to Data Mining.pptx
 
Unit-IV-Introduction to Data Warehousing .pptx
Unit-IV-Introduction to Data Warehousing .pptxUnit-IV-Introduction to Data Warehousing .pptx
Unit-IV-Introduction to Data Warehousing .pptx
 
Unit-III-AI Search Techniques and solution's
Unit-III-AI Search Techniques and solution'sUnit-III-AI Search Techniques and solution's
Unit-III-AI Search Techniques and solution's
 
Unit-II-Introduction of Artifiial Intelligence.pptx
Unit-II-Introduction of Artifiial Intelligence.pptxUnit-II-Introduction of Artifiial Intelligence.pptx
Unit-II-Introduction of Artifiial Intelligence.pptx
 
Unit-I-Introduction to Recent Trends.pptx
Unit-I-Introduction to Recent Trends.pptxUnit-I-Introduction to Recent Trends.pptx
Unit-I-Introduction to Recent Trends.pptx
 
Using Unix Commands.pptx
Using Unix Commands.pptxUsing Unix Commands.pptx
Using Unix Commands.pptx
 
Using Vi Editor.pptx
Using Vi Editor.pptxUsing Vi Editor.pptx
Using Vi Editor.pptx
 
Shell Scripting and Programming.pptx
Shell Scripting and Programming.pptxShell Scripting and Programming.pptx
Shell Scripting and Programming.pptx
 
Introduction to Unix Concets.pptx
Introduction to Unix Concets.pptxIntroduction to Unix Concets.pptx
Introduction to Unix Concets.pptx
 
Handling Files Under Unix.pptx
Handling Files Under Unix.pptxHandling Files Under Unix.pptx
Handling Files Under Unix.pptx
 
Introduction to OS.pptx
Introduction to OS.pptxIntroduction to OS.pptx
Introduction to OS.pptx
 
Using Unix Commands.pptx
Using Unix Commands.pptxUsing Unix Commands.pptx
Using Unix Commands.pptx
 
Introduction to Unix Concets.pptx
Introduction to Unix Concets.pptxIntroduction to Unix Concets.pptx
Introduction to Unix Concets.pptx
 

Recently uploaded

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 

Recently uploaded (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 

Managing Processes in Unix.pptx

  • 1. Managing Processes in Unix Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 2. Process:- Process can be defined as a program under Execution . Unix runs many programs at the Same time by using Round-robin Scheduling algorithm Shell creates a process for executing the cat command. The shell process(sh) is a parent process and the cat process is a child process . As long as process is Running , it is alive. After completing the job , it be comes in active and is said to be dead. Parent and child process:-  In Unix one process can generate another process.The process which generates another process is Called Parent process. Newly generated process is called child process.  The parent can have one or more children Eg:-$cat fruits|grep orange fruits  The shell creates two child process cat and grep simultaneously. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 3. Unix process creation:- ★ Parent is the original process. ★new process is called child. ★child cantains same code , same data of its parent. ★the parent can either wait for child to complete , or continue executing in parallel with the child. ★child is created by system call fork(). ★fork()returns 0(zero)in child process. ★fork()returns PID of new child in parent process. ★fork()system call is not successful , it returns-1. ★Resource sharing: a process needs certain resource like CPU time , Memory, I/O devices etc. ★exec()system call is used after fork(),to start another different program. ★ps command is used display a listing of currently active processes in the system. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 4.  A process means program in execution. It generally takes an input, processes it and gives us the appropriate output. Check Introduction to Process Management for more details about a process.  There are basically 2 types of processes.  Foreground processes: Such kind of processes are also known as interactive processes. These are the processes which are to be executed or initiated by the user or the programmer, they can not be initialized by system services. Such processes take input from the user and return the output. While these processes are running we can not directly initiate a new process from the same terminal.  Background processes: Such kind of processes are also known as non interactive processes. These are the processes that are to be executed or initiated by the system itself or by users, though they can even be managed by users. These processes have a unique PID or process if assigned to them and we can initiate other processes within the same terminal from which they are initiated.  Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 5. Process States in UNIX: The lifetime of a process can be conceptually divided into 9 states. 1. User Running: The process is executing in user-mode. 2. Kernel Running: The process is executing in the kernel-mode. 3. Ready to run: The process isn’t executing, but it is ready to run as soon as the kernel schedules it. 4. Asleep: The process is sleeping and resides in the main memory. 5. Ready to run, Swapped: The process is ready to run, but the swapper must swap the process into the main memory before the kernel can schedule it to execute. 6. Sleeping, Swapped: The process is sleeping, and the swapper has swapped the process to secondary storage to make room for other processes in the main memory. 7. Preempted: The process is returning from the kernel to user mode but the kernel preempts it and it does a context switch to schedule another process. 8. Created: The process is newly created and not yet ready to run. 9. Zombie: The process no longer exists, but it leaves a record for its parent process to collect. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 6. Parent and Child Processes  Each unix process has two ID numbers assigned to it: The Process ID (pid) and the Parent process ID (ppid). Each user process in the system has a parent process.  Most of the commands that you run have the shell as their parent. Check the ps -f example where this command listed both the process ID and the parent process ID. Zombie and Orphan Processes  Normally, when a child process is killed, the parent process is updated via a SIGCHLD signal. Then the parent can do some other task or restart a new child as needed. However, sometimes the parent process is killed before its child is killed. In this case, the "parent of all processes," the init process, becomes the new PPID (parent process ID). In some cases, these processes are called orphan processes.  When a process is killed, a ps listing may still show the process with a Z state. This is a zombie or defunct process. The process is dead and not being used. These processes are different from the orphan processes. They have completed execution but still find an entry in the process table. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 7. Daemon Processes  Daemons are system-related background processes that often run with the permissions of root and services requests from other processes.  A daemon has no controlling terminal. It cannot open /dev/tty. If you do a "ps -ef" and look at the tty field, all daemons will have a ? for the tty.  To be precise, a daemon is a process that runs in the background, usually waiting for something to happen that it is capable of working with. For example, a printer daemon waiting for print commands.  If you have a program that calls for lengthy processing, then it’s worth to make it a daemon and run it in the background. The top Command  The top command is a very useful tool for quickly showing processes sorted by various criteria.  It is an interactive diagnostic tool that updates frequently and shows information about physical and virtual memory, CPU usage, load averages, and your busy processes.  Here is the simple syntax to run top command and to see the statistics of CPU utilization by different processes −$top Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 8. Job ID Versus Process ID  Background and suspended processes are usually manipulated via job number (job ID). This number is different from the process ID and is used because it is shorter.  In addition, a job can consist of multiple processes running in a series or at the same time, in parallel. Using the job ID is easier than tracking individual processes. Nice command:-  It is used to change or set the priority of a process  syntax: $nice-value cat filename  The default priority of a process in unix is 20  The value range from 0 to 39, in linux-9 to 20.where 0 is high and 39 is lower value.  the default value of reduction is 10.  The priority of a process can be increased only by administrator using double minus(--).  eg:-$nice--15catlast.txt  The priority of a process can be made lower using the nice command. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 9. For example: if a process is already running and using a lot of cpu time ; then it can be reniced.  i.e.$nicecatlast.txt  $nice-10catlast.txt  $nice--15catlast.txt Process Termination:- There are situations when the user has to terminate a process prematurely. Several reasons are Possible for process termination such as: ★The terminal hangs. ★user logs off. ★Program execution has gone into endless loop. ★ Error and fault conditions. ★Time lim ★ Memory unavailable it exceeded. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 10. ★I/O failure. ★Data misuse. ★system performance slow due to too many background processes running. ★Operating system intervention(for example to resolve , adeadlock).When a UNIX process is terminated normally , it ★Close all files. ★save usage status. ★Makes init process the parent of live children. ★Changes run state to zombie. Communication commands:- 1)Kill command : Termination of a process forcibly is called killing.  Background process can be terminated by using kill command.  A foreground process is terminated using del key or break key.  PID is used to select the process.  Syntax:-$kill PID. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 11.  More than one process can be killed using a single kill command.  A special variable$!(That holds PID of last background process)  Used to killl last background process.  A special variable $$(That holds PID of current shell)used to kill current shell.  $kill 0:to terminate all process of a user.  $kill -90:to terminate all process of a user including the login shell. 2)mesg command:-is used to change the write permission of a user.  Syntax:-$mesg y #grant the write permission.  $mesg n #denise the write permission.  $mes g #current write status.  If user doesn't want to be disturbed , he can deny the write permission.  But super can send message irrespective of permission. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 12. 3)Write command: allows two way communication between two users Who are currently logged in and have given write permission. Syntax:-$write username  The user A can send messages to user B who is logged in.  Then user B get message with a beep sound , then B replies.  But both the users must be logged in. 4)Finger command:-is similar to who command , it shows current login details and shows asterisk symbol for those who have permission to accept messages. Syntax:-$finger 5)wall command:-wall stands for write all. wall command is used only by the super user to send messages to all users on the system.It is also known as broadcasting a message to all users , irrespective of there permissions. Syntax:-$wal
  • 13. Fg  You can use the command “fg” to continue a program which was stopped and bring it to the foreground.  The simple syntax for this utility is: e.g:fg jobname Top  This utility tells the user about all the running processes on the Linux machine. PS  This command stands for ‘Process Status’. It is similar to the “Task Manager” that pop-ups in a Windows Machine when we use Cntrl+Alt+Del. This command is similar to ‘top’ command but the information displayed is different.  To check all the processes running under a user, use the command – e.g ps ux Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 14. You can also check the process status of a single process, use the syntax –  ps P Kill  This command terminates running processes on a Linux machine.  To use these utilities you need to know the PID (process id) of the process you want to kill  Syntax –kill PID To find the PID of a process simply type  pidof Process name DF  This utility reports the free disk space(Hard Disk) on all the file systems. 'df -h' Free  This command shows the free and used memory (RAM) on the Linux system. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 15. Command Description bg To send a process to the background fg To run a stopped process in the foreground top Details on all Active Processes ps Give the status of processes running for a user ps PID Gives the status of a particular process pidof Gives the Process ID (PID) of a process kill PID Kills a process nice Starts a process with a given priority renice Changes priority of an already running process df Gives free hard disk space on your system free Gives free RAM on your system Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 16. Thanks ! Mrs.Harsha V Patil, MIT ACSC Alandi , Pune