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

AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
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
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 

Recently uploaded (20)

AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
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...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 

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