Signals are software interrupts that give us a way to handle asynchronous events.Stuck with your System Programming Assignment. Get 24/7 help from tutors with Phd in the subject. Email us at support@helpwithassignment.com
Reach us at http://www.HelpWithAssignment.com
Intel Processor Trace (or Intel PT) is an processor extension for IA64 and IA32. The extension captures how a program got executed in machine-instruction level. All dynamic events, such as, branches, calls and interrupts, are recorded. This allows perfect reconstruction of previous execution by a trace analyzer.
This slide summarizes which data is generated out from this extension.
Linux Performance Analysis: New Tools and Old SecretsBrendan Gregg
Talk for USENIX/LISA2014 by Brendan Gregg, Netflix. At Netflix performance is crucial, and we use many high to low level tools to analyze our stack in different ways. In this talk, I will introduce new system observability tools we are using at Netflix, which I've ported from my DTraceToolkit, and are intended for our Linux 3.2 cloud instances. These show that Linux can do more than you may think, by using creative hacks and workarounds with existing kernel features (ftrace, perf_events). While these are solving issues on current versions of Linux, I'll also briefly summarize the future in this space: eBPF, ktap, SystemTap, sysdig, etc.
This talk is all about the Berkeley Packet Filters (BPF) and their uses in Linux.
Agenda:
* What is a BPF and why do we need it?
* Writing custom BPFs
* Notes on BPF implementation in the kernel
* Usage examples: SOCKET_FILTER & seccomp
Speaker:
Kfir Gollan, senior embedded software developer, Linux kernel hacker and software team leader.
Intel Processor Trace (or Intel PT) is an processor extension for IA64 and IA32. The extension captures how a program got executed in machine-instruction level. All dynamic events, such as, branches, calls and interrupts, are recorded. This allows perfect reconstruction of previous execution by a trace analyzer.
This slide summarizes which data is generated out from this extension.
Linux Performance Analysis: New Tools and Old SecretsBrendan Gregg
Talk for USENIX/LISA2014 by Brendan Gregg, Netflix. At Netflix performance is crucial, and we use many high to low level tools to analyze our stack in different ways. In this talk, I will introduce new system observability tools we are using at Netflix, which I've ported from my DTraceToolkit, and are intended for our Linux 3.2 cloud instances. These show that Linux can do more than you may think, by using creative hacks and workarounds with existing kernel features (ftrace, perf_events). While these are solving issues on current versions of Linux, I'll also briefly summarize the future in this space: eBPF, ktap, SystemTap, sysdig, etc.
This talk is all about the Berkeley Packet Filters (BPF) and their uses in Linux.
Agenda:
* What is a BPF and why do we need it?
* Writing custom BPFs
* Notes on BPF implementation in the kernel
* Usage examples: SOCKET_FILTER & seccomp
Speaker:
Kfir Gollan, senior embedded software developer, Linux kernel hacker and software team leader.
Kernel Recipes 2017: Using Linux perf at NetflixBrendan Gregg
Talk for Kernel Recipes 2017 by Brendan Gregg. "Linux perf is a crucial performance analysis tool at Netflix, and is used by a self-service GUI for generating CPU flame graphs and other reports. This sounds like an easy task, however, getting perf to work properly in VM guests running Java, Node.js, containers, and other software, has been at times a challenge. This talk summarizes Linux perf, how we use it at Netflix, the various gotchas we have encountered, and a summary of advanced features."
O'Reilly Velocity New York 2016 presentation on modern Linux tracing tools and technology. Highlights the available tracing data sources on Linux (ftrace, perf_events, BPF) and demonstrates some tools that can be used to obtain traces, including DebugFS, the perf front-end, and most importantly, the BCC/BPF tool collection.
As computer systems become more sophisticated, process injection techniques also evolve. These techniques are notorious for their use by "malicious software" to hide code execution and avoid detection. In this presentation we dive deep into the Windows runtime and we demonstrate these techniques. Besides, we also learn how to code construction and design patterns that relate to perform hidden code can recognize.
Linux kernel tracing superpowers in the cloudAndrea Righi
The Linux 4.x series introduced a new powerful engine of programmable tracing (BPF) that allows to actually look inside the kernel at runtime. This talk will show you how to exploit this engine in order to debug problems or identify performance bottlenecks in a complex environment like a cloud. This talk will cover the latest Linux superpowers that allow to see what is happening “under the hood” of the Linux kernel at runtime. I will explain how to exploit these “superpowers” to measure and trace complex events at runtime in a cloud environment. For example, we will see how we can measure latency distribution of filesystem I/O, details of storage device operations, like individual block I/O request timeouts, or TCP buffer allocations, investigating stack traces of certain events, identify memory leaks, performance bottlenecks and a whole lot more.
Compromising Linux Virtual Machines with Debugging MechanismsRussell Sanford
This presentation covers utilizing VMwares (GDB) debugging protocol to invasive inject commands into a Linux-x64 target. Automatic detection of kernel API is performed to locate _vmalloc & call_usermodehelper* functions across all 3x and 4x kernels.
Nadav Markus goes over the path from a simple crash POC provided by Google Project Zero (for CVE-2015-7547), to a fully weaponized exploit.
He explores how an attacker can utilize the behavior of the Linux kernel in order to bypass ASLR, allowing an attacker to remotely execute code on vulnerable targets.
Introduction to DTrace (Dynamic Tracing), written by Brendan Gregg and delivered in 2007. While aimed at a Solaris-based audience, this introduction is still largely relevant today (2012). Since then, DTrace has appeared in other operating systems (Mac OS X, FreeBSD, and is being ported to Linux), and, many user-level providers have been developed to aid tracing of other languages.
Tracing MariaDB server with bpftrace - MariaDB Server Fest 2021Valeriy Kravchuk
Bpftrace is a relatively new eBPF-based open source tracer for modern Linux versions (kernels 5.x.y) that is useful for analyzing production performance problems and troubleshooting software. Basic usage of the tool, as well as bpftrace one liners and advanced scripts useful for MariaDB DBAs are presented. Problems of MariaDB Server dynamic tracing with bpftrace and some possible solutions and alternative tracing tools are discussed.
Dynamic Instrumentation- OpenEBS Golang Meetup July 2017OpenEBS
The slides were presented by Jeffry Molanus who is the CTO of OpenEBS in Golang Meetup. OpenEBS is an open source cloud native storage. OpenEBS delivers storage and storage services to containerized environments. OpenEBS allows stateful workloads to be managed more like stateless containers. OpenEBS storage services include: per container (or pod) QoS SLAs, tiering and replica policies across AZs and environments, and predictable and scalable performance.Our vision is simple: let’s let storage and storage services for persistent workloads be so fully integrated into the environment and hence managed automatically that is almost disappears into the background as just yet another infrastructure service that works.
Kernel Recipes 2017: Performance Analysis with BPFBrendan Gregg
Talk by Brendan Gregg at Kernel Recipes 2017 (Paris): "The in-kernel Berkeley Packet Filter (BPF) has been enhanced in recent kernels to do much more than just filtering packets. It can now run user-defined programs on events, such as on tracepoints, kprobes, uprobes, and perf_events, allowing advanced performance analysis tools to be created. These can be used in production as the BPF virtual machine is sandboxed and will reject unsafe code, and are already in use at Netflix.
Beginning with the bpf() syscall in 3.18, enhancements have been added in many kernel versions since, with major features for BPF analysis landing in Linux 4.1, 4.4, 4.7, and 4.9. Specific capabilities these provide include custom in-kernel summaries of metrics, custom latency measurements, and frequency counting kernel and user stack traces on events. One interesting case involves saving stack traces on wake up events, and associating them with the blocked stack trace: so that we can see the blocking stack trace and the waker together, merged in kernel by a BPF program (that particular example is in the kernel as samples/bpf/offwaketime).
This talk will discuss the new BPF capabilities for performance analysis and debugging, and demonstrate the new open source tools that have been developed to use it, many of which are in the Linux Foundation iovisor bcc (BPF Compiler Collection) project. These include tools to analyze the CPU scheduler, TCP performance, file system performance, block I/O, and more."
Delivered at the FISL13 conference in Brazil: http://www.youtube.com/watch?v=K9w2cipqfvc
This talk introduces the USE Method: a simple strategy for performing a complete check of system performance health, identifying common bottlenecks and errors. This methodology can be used early in a performance investigation to quickly identify the most severe system performance issues, and is a methodology the speaker has used successfully for years in both enterprise and cloud computing environments. Checklists have been developed to show how the USE Method can be applied to Solaris/illumos-based and Linux-based systems.
Many hardware and software resource types have been commonly overlooked, including memory and I/O busses, CPU interconnects, and kernel locks. Any of these can become a system bottleneck. The USE Method provides a way to find and identify these.
This approach focuses on the questions to ask of the system, before reaching for the tools. Tools that are ultimately used include all the standard performance tools (vmstat, iostat, top), and more advanced tools, including dynamic tracing (DTrace), and hardware performance counters.
Other performance methodologies are included for comparison: the Problem Statement Method, Workload Characterization Method, and Drill-Down Analysis Method.
Stuck with your Forecasting Assignment? Get 24/7 help from tutors with Phd in the subject. Email us at support@helpwithassignment.com
Reach us at http://www.HelpWithAssignment.com
Kernel Recipes 2017: Using Linux perf at NetflixBrendan Gregg
Talk for Kernel Recipes 2017 by Brendan Gregg. "Linux perf is a crucial performance analysis tool at Netflix, and is used by a self-service GUI for generating CPU flame graphs and other reports. This sounds like an easy task, however, getting perf to work properly in VM guests running Java, Node.js, containers, and other software, has been at times a challenge. This talk summarizes Linux perf, how we use it at Netflix, the various gotchas we have encountered, and a summary of advanced features."
O'Reilly Velocity New York 2016 presentation on modern Linux tracing tools and technology. Highlights the available tracing data sources on Linux (ftrace, perf_events, BPF) and demonstrates some tools that can be used to obtain traces, including DebugFS, the perf front-end, and most importantly, the BCC/BPF tool collection.
As computer systems become more sophisticated, process injection techniques also evolve. These techniques are notorious for their use by "malicious software" to hide code execution and avoid detection. In this presentation we dive deep into the Windows runtime and we demonstrate these techniques. Besides, we also learn how to code construction and design patterns that relate to perform hidden code can recognize.
Linux kernel tracing superpowers in the cloudAndrea Righi
The Linux 4.x series introduced a new powerful engine of programmable tracing (BPF) that allows to actually look inside the kernel at runtime. This talk will show you how to exploit this engine in order to debug problems or identify performance bottlenecks in a complex environment like a cloud. This talk will cover the latest Linux superpowers that allow to see what is happening “under the hood” of the Linux kernel at runtime. I will explain how to exploit these “superpowers” to measure and trace complex events at runtime in a cloud environment. For example, we will see how we can measure latency distribution of filesystem I/O, details of storage device operations, like individual block I/O request timeouts, or TCP buffer allocations, investigating stack traces of certain events, identify memory leaks, performance bottlenecks and a whole lot more.
Compromising Linux Virtual Machines with Debugging MechanismsRussell Sanford
This presentation covers utilizing VMwares (GDB) debugging protocol to invasive inject commands into a Linux-x64 target. Automatic detection of kernel API is performed to locate _vmalloc & call_usermodehelper* functions across all 3x and 4x kernels.
Nadav Markus goes over the path from a simple crash POC provided by Google Project Zero (for CVE-2015-7547), to a fully weaponized exploit.
He explores how an attacker can utilize the behavior of the Linux kernel in order to bypass ASLR, allowing an attacker to remotely execute code on vulnerable targets.
Introduction to DTrace (Dynamic Tracing), written by Brendan Gregg and delivered in 2007. While aimed at a Solaris-based audience, this introduction is still largely relevant today (2012). Since then, DTrace has appeared in other operating systems (Mac OS X, FreeBSD, and is being ported to Linux), and, many user-level providers have been developed to aid tracing of other languages.
Tracing MariaDB server with bpftrace - MariaDB Server Fest 2021Valeriy Kravchuk
Bpftrace is a relatively new eBPF-based open source tracer for modern Linux versions (kernels 5.x.y) that is useful for analyzing production performance problems and troubleshooting software. Basic usage of the tool, as well as bpftrace one liners and advanced scripts useful for MariaDB DBAs are presented. Problems of MariaDB Server dynamic tracing with bpftrace and some possible solutions and alternative tracing tools are discussed.
Dynamic Instrumentation- OpenEBS Golang Meetup July 2017OpenEBS
The slides were presented by Jeffry Molanus who is the CTO of OpenEBS in Golang Meetup. OpenEBS is an open source cloud native storage. OpenEBS delivers storage and storage services to containerized environments. OpenEBS allows stateful workloads to be managed more like stateless containers. OpenEBS storage services include: per container (or pod) QoS SLAs, tiering and replica policies across AZs and environments, and predictable and scalable performance.Our vision is simple: let’s let storage and storage services for persistent workloads be so fully integrated into the environment and hence managed automatically that is almost disappears into the background as just yet another infrastructure service that works.
Kernel Recipes 2017: Performance Analysis with BPFBrendan Gregg
Talk by Brendan Gregg at Kernel Recipes 2017 (Paris): "The in-kernel Berkeley Packet Filter (BPF) has been enhanced in recent kernels to do much more than just filtering packets. It can now run user-defined programs on events, such as on tracepoints, kprobes, uprobes, and perf_events, allowing advanced performance analysis tools to be created. These can be used in production as the BPF virtual machine is sandboxed and will reject unsafe code, and are already in use at Netflix.
Beginning with the bpf() syscall in 3.18, enhancements have been added in many kernel versions since, with major features for BPF analysis landing in Linux 4.1, 4.4, 4.7, and 4.9. Specific capabilities these provide include custom in-kernel summaries of metrics, custom latency measurements, and frequency counting kernel and user stack traces on events. One interesting case involves saving stack traces on wake up events, and associating them with the blocked stack trace: so that we can see the blocking stack trace and the waker together, merged in kernel by a BPF program (that particular example is in the kernel as samples/bpf/offwaketime).
This talk will discuss the new BPF capabilities for performance analysis and debugging, and demonstrate the new open source tools that have been developed to use it, many of which are in the Linux Foundation iovisor bcc (BPF Compiler Collection) project. These include tools to analyze the CPU scheduler, TCP performance, file system performance, block I/O, and more."
Delivered at the FISL13 conference in Brazil: http://www.youtube.com/watch?v=K9w2cipqfvc
This talk introduces the USE Method: a simple strategy for performing a complete check of system performance health, identifying common bottlenecks and errors. This methodology can be used early in a performance investigation to quickly identify the most severe system performance issues, and is a methodology the speaker has used successfully for years in both enterprise and cloud computing environments. Checklists have been developed to show how the USE Method can be applied to Solaris/illumos-based and Linux-based systems.
Many hardware and software resource types have been commonly overlooked, including memory and I/O busses, CPU interconnects, and kernel locks. Any of these can become a system bottleneck. The USE Method provides a way to find and identify these.
This approach focuses on the questions to ask of the system, before reaching for the tools. Tools that are ultimately used include all the standard performance tools (vmstat, iostat, top), and more advanced tools, including dynamic tracing (DTrace), and hardware performance counters.
Other performance methodologies are included for comparison: the Problem Statement Method, Workload Characterization Method, and Drill-Down Analysis Method.
Stuck with your Forecasting Assignment? Get 24/7 help from tutors with Phd in the subject. Email us at support@helpwithassignment.com
Reach us at http://www.HelpWithAssignment.com
Performance Appraisal Systems take a variety of forms and are central to Performance Management Systems.
Appraisal takes place annually between the manager and the employee
The marketer develops a complete profile of the various segments found in the market, one or more is selected for a concerned marketing effort. This is known as market targeting.
Rights of the Parties and Discharge; Remedies for Breach of ContractHelpWithAssignment.com
Business law is the body of law that applies to the rights, relations, and conduct of persons and businesses engaged in commerce, merchandising, trade, and sales.It is often considered to be a branch of civil law and deals with issues of both private law and public law.
Stationary Quantum State: introduced by Niels Bohr, 1913:
A property of a stationary quantum state of a physical system of constant
energy is that probability to find a particle in any element of volume is
independent of the time. A stationary quantum state may be defined as a
condition of a system such that all observable physical properties are
independent of the time.
Markets and the companies operating in markets are linked by information. Increase in the amount of information available to the companies can lead to the complex decision making environment.
Stuck with your hypothesis testing Assignment. Get 24/7 help from tutors with Phd in the subject. Email us at support@helpwithassignment.com
Reach us at http://www.HelpWithAssignment.com
Constructivism is a learning theory that perceives that people acquire knowledge through their experiences, interaction with the outside world and their ideas of the world around them.
What is program and process .
Program execution flow .
Example of process generation .
Description of process .
Types of process .
Ways of run process .
How process is generated using fork() and execution .
Process life cycle .
Process tree .
Process states .
Load Averages .
For monitoring and managing linux process tools .
Process management in operating system | process states | PCB | FORK() | Zomb...Shivam Mitra
This is the second part of the operating system interview series.
In this session, we will look at the following:
1. Program vs process
2. Process states
3. Process control block
4. Process lifecycle using fork(), exec(), exit() and wait()
5. Zombie and orphan process
Ethnobotany and Ethnopharmacology:
Ethnobotany in herbal drug evaluation,
Impact of Ethnobotany in traditional medicine,
New development in herbals,
Bio-prospecting tools for drug discovery,
Role of Ethnopharmacology in drug evaluation,
Reverse Pharmacology.
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
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.
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?
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
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.
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
2. A UNIX PROCESS
• Each process is identified by a unique integer,
the process identifier (PID)
• Each identifier is associated with a process
descriptor inside the OS scheduler
• A list of PIDs can be obtained with the ps
aux command
• Information about each process can be found in
/proc/pidn which is a directory
corresponding to each PID
4. PROCESS STARTUP AND TERMINATION
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char *argv[]);
void exit(int status);
void _exit(int status);
• main() is passed the command line arguments and
should return the termination status
• exit() takes the termination status and causes any
files to be properly closed and memory released
• _exit() terminates the process immediately
closing all file descriptors but not cleanly
5. PROCESS STARTUP AND TERMINATION
#include <stdlib.h>
int atexit(void (*func)(void));
Returns 0 if OK, -1 on error
• The exit() function calls any registered user exit
functions before calling the termination functions
• Exit functions are registered using atexit() which
takes a pointer to a function that does not return
anything and takes no arguments
• Calling _exit() directly allows us to skip these
registered atexit functions
7. ENVIRONMENT LIST
• Each program is passed an environment list
• The address of the array of pointers is
contained in the global variable environ:
extern char **environ;
9. C PROGRAM MEMORY LAYOUT
• Text segment contains the machine instruction
that the CPU executes (shareable, read-only)
• Initialised data segment contains variables that
are specifically initialised in the program
• Uninitialized data segment (bss) which is
initialised by the kernel to arithmetic 0 or null
pointers before program execution
• Stack, where automatic variables and function
information are stored
• Heap for dynamic memory allocation
10. SHARED LIBRARIES
• Remove common library routines from the
executable file, maintaining a single copy
somewhere in memory
• Reduces the size of each executable, but adds
runtime overhead
• Library function can be replaced with new
versions without having to edit every program
which use them
• -static to gcc disables use of shared
memory
11. RESOURCE LIMITS
Every process has a set of resource limits, some
of which can be queried/changed by
#include <sys/resources.h>
int getrlimit(int resource, struct rlimit
*rlptr)
int setrlimit(int resource, const struct
rlimit rlptr);
Both return 0 if OK, nonzero on error
12. RESOURCE LIMITS
• A process can change its soft limit to a value
less than or equal to its hard limit
• A process can lower its hard limit to a value
greater then or equal to its soft limit
• Only a superuser process can raise hard limits
• Resource limits affect the calling process and
are inherited by its children
• Limits include process available memory, open
files, max CPU time, max number of locks…
13. PROCESS IDENTIFIERS
• Every process has a unique ID
• PIDs are reused (delay reuse)
• PID 0 is usually the scheduler process
(swapper), and is part of the kernel
• PID 1 is usually init and is invoked by the
kernel at the end of the bootstrap procedure
• It is responsible for bringing up a UNIX system,
bootstrapping the kernel and running read
system-dependent initialisation files
(/etc/rc*)
14. FORK
• An existing process can create a new one by
calling the fork function
• The new process is called the child process
• Function returns twice, once in the child and
once in the parent process
#include <unistd.h>
pid_t fork(void);
Returns 0 in child, child ID in
parent and 1 on error
15. FORK
• Both processes continue executing with the instruction
that follows the fork
• The child is a copy of the parent (child gets a copy of
data space, heap and stack)
• Parent and child do not share portions of memory,
however they do share text segment
• Copy-on-write (COW) is generally used, where
regions are shared and have their protections
changed by the kernel to read-only. If either process
tries to modify them, the kernel makes a copy of that
place of memory only (typically page in a virtual
memory system)
16. FORK
int main(void)
{
pid_t pid;
if ((pid = fork()) < 0)
{
fprintf(stderr, "fork error");
}
else if (pid == 0)
{
// Child process
} else
{
// Parent process
}
exit(0);
}
17. FORK USES
• Two main reasons:
• When a process wants to duplicate itself so
that the parent and child can execute
different sections of code at the same time
(common for network servers)
• When a process wants to execute a different
program (common for shells)
18. FILE SHARING
• All file descriptors that are open in the parent
are duplicated in the child (dup)
• The parent and child share a file table entry
for every open descriptor, sharing the same
offset
• Two cases for handling descriptors after fork:
• Parent waits for child process to complete
• Both processes go their own way, parent and
child close descriptors they don’t need. This is
usually the case for network servers
20. SHARED PROPERTIES
• Real, effective, supplementary IDs
• Process group ID
• Controlling terminal
• CWD, root directory
• File creation mode mask
• Signal mask and dispositions
• Environment
• Attached shared memory segments
• Memory mappings
• Resource limits
21. VFORK
• vfork is intended to create a new process when
the purpose of the new process is to exec a new
program
• Creates a new process like fork without copying
the address space of the parent into the child
• The child runs in the address space of the parent
• This optimisation provides an efficient gain on
some paged virtual-memory implementations
• Guarantees that the child runs first until it calls
exec or exit
22. EXIT FUNCTIONS
• A process can terminate normally in 5 ways:
• Executing a return from main
• Calling the exit function
• Calling _exit or _Exit
• Executing a return from the start routine of the
last thread in the process
• Calling pthread_exit from the last thread in
the process
• Abnormal termination include calling abort and
reception of certain signals
23. EXIT FUNCTIONS
• The init process becomes the parent of any
process whose parent terminates (the process is
inherited by init)
• Whenever a process terminates the kernel goes
through all active processes to see whether the
terminating process is the parent of any
process that still exists
• If so, the parent process ID of the surviving
process is changed to 1
24. WAIT FUNCTIONS
• When a process terminates the kernel notifies
the parent by sending the SIGCHLD signal
• This has to be an asynchronous notification
• Parent can ignore signal or provide a function
to handle it (default is to ignore)
#include <sys/wait>
pid_t wait(int *statloc);
pid_t waitpid(pid_t pid, int *statloc,
int options);
Return PID if OK, 1 on error or 0
25. WAIT FUNCTIONS
• A process that calls wait or waitpid can:
• Block if all its children are still running
• Return immediately with the termination
status of a child
• Return immediately with an error if it doesn’t
have any child processes
• If a child already terminated and is a zombie
wait returns immediately with the child’s status
• statloc is a pointer to an integer
26. WAIT FUNCTIONS
Two additional functions allow the kernel to return a
summary of the resources used by the terminated process
and all its children
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <sys/resources.h>
pid_t wait3(int *statloc, int options,
struct rusage *rusage);
pid_t wait4(pid_t pid, int *statloc, int
options, struct rusage *rusage);
Return PID if OK, 1 on error or 0
27. RACE CONDITIONS
• A race condition occurs when multiple
processes are trying to do something with
shared data and the final outcome depends
on the order in which the processes run
• A process that wants to wait for a child to
terminate must call one of the wait
functions
• To avoid race conditions (and polling)
signalling between multiple processes is
required
28. EXEC FUNCTIONS
• When exec is called, the process is completely
replaced by the new program and the new
program starts executing its main function
• The PID does not change, because a new
process is not created
• Process text, data, heap and stack segments
are replaced by the new program from disk
• The exec, fork and wait functions are the only
process control primitives, except for additional
built-in functions
29. EXEC FUNCTIONS
#include <unistd.h>
int execl(const char *pathname, const char* arg0
… /* (char *) 0 */);
int execv(const char *pathname, char *const
argv[]);
int execle(const char *pathname, const char
*arg0, … /*(char *) 0, char envp[] */);
int execve(const char *pathname, char *const
argv[], char *const envp[]);
int execlp(const char *filename, const char
*arg0, … /* (char *)0 */);
int execvp(const char *filename, char *const
argv[]);
Return 1 on error, no return on success
32. EXEC FUNCTIONS
• New program inherits some properties from the
calling process:
• PID and parent PID
• User and group IDs
• Controlling terminal
• CWD, root directory
• File mode creation mask
• File locks
• Process signal mask
• Pending signals
• Resource limits
33. MISC FUNCTIONS
• system allows the user to execute a command
string from within the program
• getlogin return the user login name
#include <stdlib.h>
#include <unistd.h>
int system(const char* cmdstring)
Return value depends on operation
char *getlogin(void)
Return NULL on error
34. PROCESS GROUPS
• A collection of one or more processes (usually
associated with the same job) that can receive signals
from the same terminal
• Each group has a unique process group ID
• Each process group can have a leader (Group ID =
process ID)
• Leader can create a process group, create processes
in the group and then terminate
• Group exists as long as at least one process is in the
group (group lifetime)