SlideShare a Scribd company logo
UNIX PROCESSES
1
Sunil Kumar R.M Assistant Professor
RLJIT
2
Sunil Kumar R.M Assistant Professor
RLJIT
MAIN FUNCTION
 PROTOTYPE:
int main(int argc, char *argv[ ]);
Argc – is the number of command line
arguments
argv [ ] – is an array of pointers to the
arguments
3
Sunil Kumar R.M Assistant Professor
RLJIT
 A C program is started by a kernel
 A special start up routine is called before
the main function is called
 This start up routine takes values from the
kernel and sets things up so that the main
function is called
4
Sunil Kumar R.M Assistant Professor
RLJIT
Process termination
 Normal termination
* return from main
* calling exit
* calling _exit
 Abnormal termination
* calling abort
* terminated by a signal
5
Sunil Kumar R.M Assistant Professor
RLJIT
exit and _exit functions
 _exit returns to kernel immediately
 exit performs certain cleanup processing
and then returns to kernel
 PROTOTYPE
#include <stdlib.h>
void _exit (int status)
void exit (int status)
6
Sunil Kumar R.M Assistant Professor
RLJIT
 The exit status is undefined if
1. Either of these function is called without
an exit status
2. Main does a return without a return value
3. Main “falls of the end”
7
Sunil Kumar R.M Assistant Professor
RLJIT
At exit function
 With ANSI C a process can register up to
32 functions that are called by exit ---called
exit handlers
 Exit handlers are registered by calling the
atexit function
#include <stdlib.h>
Int atexit (void (*clearfun) void));
8
Sunil Kumar R.M Assistant Professor
RLJIT
 Atexit function calls these functions in
reverse order of their registration
 Each function is called as many times as
it was registered
9
Sunil Kumar R.M Assistant Professor
RLJIT
#include "ourhdr.h"
static void my_exit1(void), my_exit2(void);
int main(void)
{
if (atexit(my_exit2) != 0)
err_sys("can't register my_exit2");
if (atexit(my_exit1) != 0)
err_sys("can't register my_exit1");
if (atexit(my_exit1) != 0)
err_sys("can't register my_exit1");
printf("main is donen");
return(0);
}
10
Sunil Kumar R.M Assistant Professor
RLJIT
static void
my_exit1(void)
{
printf("first exit handlern");
}
static void
my_exit2(void)
{
printf("second exit handlern");
}
11
Sunil Kumar R.M Assistant Professor
RLJIT
Command-line arguments
 /* program to echo command line
arguments*/
int main (int argc, char* argv[ ])
{
for(int i=0;i<argc ;i++)
{
printf(“argv[%d]:%s n”,i,argv[i]);
}
}
12
Sunil Kumar R.M Assistant Professor
RLJIT
Environment list
 Environment list – is an array of character
pointers ,where each pointer contains the
address of a null terminated C string
 The address of array of pointers is
contained in global variable environ
 extern char **environ;
 each string is of the form name=value
13
Sunil Kumar R.M Assistant Professor
RLJIT
NULL
HOME=/home/abc
PATH=:/bin:/usr/bin0
Environment
pointer
Environment
list
14
Sunil Kumar R.M Assistant Professor
RLJIT
Memory layout of a C program
 Text segment – sharable copy
 Initialized data segment – variables
specifically initialized in the program
 Uninitialized data segment – “bss”
segment
data is initialized to arithematic 0 or null
 Stack – return address and information
about caller’s environment
 Heap – dynamic memory allocation takes
place on the heap
15
Sunil Kumar R.M Assistant Professor
RLJIT
Stack
heap
Uninitialised data
initialised data
Text
Command line arguments
And environment variables
Intialized to 0 by exec
Read from
prog File
by exec
High address
Low address
16
Sunil Kumar R.M Assistant Professor
RLJIT
The size(1) command reports
the sizes (in bytes) of the text,
data, and bss segments#include <stdio.h>
int main(void)
{
return 0;
}
.
17
Sunil Kumar R.M Assistant Professor
RLJIT
Shared libraries
 Shared libraries remove the common
library routines from the executable file ,
instead maintaining a single copy of the
library routine some where in memory
that all processes reference
 Advantage: reduces size of executable
file,
easy to replace with a newer version
 Disadvantage: some- runtime overhead
18
Sunil Kumar R.M Assistant Professor
RLJIT
 Linking: Here is where all of the object files and
any libraries are linked together to make your
final program. Note that for static libraries, the
actual library is placed in your final program,
while for shared libraries, only a reference to the
library is placed inside.
19
Sunil Kumar R.M Assistant Professor
RLJIT
20
Sunil Kumar R.M Assistant Professor
RLJIT
Memory allocation
 malloc : allocates specified number of
bytes of memory
 calloc : allocates specified number of
objects of specified size
 realloc : changes size of previous
allocated area
21
Sunil Kumar R.M Assistant Professor
RLJIT
#include <stdlib.h>
void *malloc (size_t size);
void *calloc (size_t nobj, size_t size);
void *realloc (void *ptr, size_t newsize);
realloc may increase or decrease the
size of previously allocated area .If it
decreases the size no problem occurs
But if the size increases then………….
22
Sunil Kumar R.M Assistant Professor
RLJIT
1. Either there is enough space then the
memory is reallocated and the same
pointer is returned
2. If there is no space then it allocates new
area copies the contents of old area to
new area frees the old area and returns
pointer to the new area
23
Sunil Kumar R.M Assistant Professor
RLJIT
Alloca function
 It is same as malloc but instead of
allocating memory from heap, the memory
allocated from the stack frame of the
current function
24
Sunil Kumar R.M Assistant Professor
RLJIT
Environment variables
 Environment strings are of the form
name=value
 ANSI C defined functions
#include <stdlib.h>
char *getenv (const char *name);
int putenv (const char *str);
int setenv (const char *name, const char
*value ,int rewrite);
void unsetenv (const char *name);
25
Sunil Kumar R.M Assistant Professor
RLJIT
 Getenv : fetches a specific value from the
environment
 Putenv : takes a string of the form
name=value , if it already exists then
old value is removed
 Setenv : sets name to value. If name
already exists then a) if rewrite is non zero,
then old definition is removed
b) if rewrite is zero old definition is
retained
 Unsetenv : removes any definition of name
26
Sunil Kumar R.M Assistant Professor
RLJIT
 Removing an environment variable is
simple just find the pointer and move all
subsequent pointers down one
 But while modifying
* if size of new value<=size of old value
just copy new string over the old string
* if new value >oldvalue use malloc obtain
room for new string, replace the old
pointer in environment list for name
with pointer to this malloced area
27
Sunil Kumar R.M Assistant Professor
RLJIT
 While adding a new name call malloc
allocate room for name=value string and
copy the string to this area
 If it’s the first time a new name is added ,
use malloc to obtain area for new list of
pointers. Copy the old list of pointers to
the malloced area and add the new
pointer to its end
 If its not the first time a new name was
added ,then just reallocate area for new
pointer since the list is already on the
heap
28
Sunil Kumar R.M Assistant Professor
RLJIT
Set jump and long jump
 To transfer control from one function to
another we make use of setjmp and
longjmp functions
#include <stdio.h>
int setjmp (jmp_buf env);
void longjmp (jmp_buf env, int val);
29
Sunil Kumar R.M Assistant Professor
RLJIT
 env is of type jmp_buf ,this data type is
form of array that is capable of holding all
information required to restore the status
of the stack to the state when we call
longjmp
 Val allows us to have more than one
longjmp for one setjmp
30
Sunil Kumar R.M Assistant Professor
RLJIT
#include <stdio.h>
#include <stdlib.h>
#include <setjmp.h>
int main()
{ int val;
jmp_buf env_buffer; /* save calling environment
for longjmp */
val = setjmp( env_buffer );
if( val != 0 )
{ printf("Returned from a longjmp() with value =
%sn", val); exit(0); }
31
Sunil Kumar R.M Assistant Professor
RLJIT
 printf("Jump function calln");
jmpfunction( env_buffer );
return(0); }
void jmpfunction(jmp_buf env_buf)
{ longjmp(env_buf, “RLJITCSE"); }
Output:
Jump function call
Returned from a longjmp()
with value = RLJITCSE 32
Sunil Kumar R.M Assistant Professor
RLJIT
getrlimit and setrlimit
#include <sys/time.h>
#include <sys/resource.h>
int getrlimit (int resource ,struct
rlimit *rlptr);
int setrlimit (int resource ,const struct
rlimit *rlptr);
33
Sunil Kumar R.M Assistant Professor
RLJIT
Struct rlimit
{
rlim_t rlim_cur; /*soft limit*/
rlim_t rlim_max; /*hard limit */
}
1. Soft link can be changed by any process
to a value <= to its hard limit
2. Any process can lower its hard limit to a
value greater than or equal to its soft
limit
3. Only super user can raise hard limit
34
Sunil Kumar R.M Assistant Professor
RLJIT
 RLIMIT_CORE – max size in bytes of a
core file
 RLIMIT_CPU – max amount of CPU time in
seconds
 RLIMIT_DATA – max size in bytes of data
segment
 RLIMIT_FSIZE – max size in bytes of a file
that can be created
 RLIMIT_MEMLOCK – locked in-memory
address space
35
Sunil Kumar R.M Assistant Professor
RLJIT
 RLIMIT_NOFILE – max number of open
files per process
 RLIMIT_NPROC – max number of child
process per real user ID
 RLIMIT_OFILE – same as RLIMIT_NOFILE
 RLIMIT_RSS – max resident set size in
bytes
 RLIMIT_STACK – max size in bytes of the
stack
 RLIMIT_VMEM – max size in bytes of the
mapped address space
36
Sunil Kumar R.M Assistant Professor
RLJIT
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
#include "ourhdr.h"
#define doit(name) pr_limits(#name, name)
static voidpr_limits(char *, int);
int main(void)
{
doit(RLIMIT_CORE);
doit(RLIMIT_CPU);
doit(RLIMIT_DATA);
doit(RLIMIT_FSIZE);
37
Sunil Kumar R.M Assistant Professor
RLJIT
#ifdef RLIMIT_MEMLOCK
doit (RLIMIT_MEMLOCK);
#endif
#ifdef RLIMIT_NOFILE /* SVR4 name */
doit (RLIMIT_NOFILE);
#endif
#ifdef RLIMIT_OFILE /* 44BSD name */
doit (RLIMIT_OFILE);
#endif
38
Sunil Kumar R.M Assistant Professor
RLJIT
#ifdef RLIMIT_NPROC
doit (RLIMIT_NPROC);
#endif
#ifdef RLIMIT_RSS
doit(RLIMIT_RSS);
#endif
doit(RLIMIT_STACK);
#ifdef RLIMIT_VMEM
doit(RLIMIT_VMEM);
#endif
exit(0);
}
39
Sunil Kumar R.M Assistant Professor
RLJIT
static void
pr_limits(char *name, int resource)
{
struct rlimit limit;
if (getrlimit(resource, &limit) < 0)
err_sys("getrlimit error for %s", name);
printf("%-14s ", name);
if (limit.rlim_cur == RLIM_INFINITY)
printf("(infinite) ");
40
Sunil Kumar R.M Assistant Professor
RLJIT
else
printf("%10ld ", limit.rlim_cur);
if (limit.rlim_max == RLIM_INFINITY)
printf("(infinite)n");
else
printf("%10ldn", limit.rlim_max);
}
41
Sunil Kumar R.M Assistant Professor
RLJIT
Kernel support for processes

File descriptor table
Current directory
root
text
data
stack
Per process u-area
Per process region table
Kernel region table
Process table
42
Sunil Kumar R.M Assistant Professor
RLJIT
 A process consists of
 A text segment – program text of a
process in machine executable
instruction code format
 A data segment – static and global
variables in machine executable format
 A stack segment – function arguments,
automatic variables and return addresses
of all active functions of a process at any
time
 U-area is an extension of Process table
entry and contains process-specific data
43
Sunil Kumar R.M Assistant Professor
RLJIT

Fd table
stack
data
text
stack
data
File tableparent
child
Process table
Kernel region table
Fd table
44
Sunil Kumar R.M Assistant Professor
RLJIT
Besides open files the other properties
inherited by child are
 Real user ID, group ID, effective user ID,
effective group ID
 Supplementary group ID
 Process group ID
 Session ID
 Controlling terminal
 set-user-ID and set-group-ID
 Current working directory
45
Sunil Kumar R.M Assistant Professor
RLJIT
 Root directory
 Signal handling
 Signal mask and dispositions
 Umask
 Nice value
 The difference between the parent & child
 The process ID
 Parent process ID
 File locks
 Alarms clock time
 Pending signals
46
Sunil Kumar R.M Assistant Professor
RLJIT

More Related Content

What's hot

Unit 7
Unit 7Unit 7
Unit 7
siddr
 
The Ring programming language version 1.3 book - Part 60 of 88
The Ring programming language version 1.3 book - Part 60 of 88The Ring programming language version 1.3 book - Part 60 of 88
The Ring programming language version 1.3 book - Part 60 of 88
Mahmoud Samir Fayed
 
Linux
LinuxLinux
Unix practical file
Unix practical fileUnix practical file
Unix practical file
Soumya Behera
 
intro unix/linux 10
intro unix/linux 10intro unix/linux 10
intro unix/linux 10
duquoi
 
Unix(introduction)
Unix(introduction)Unix(introduction)
Unix(introduction)
meashi
 
Unix Command Line Productivity Tips
Unix Command Line Productivity TipsUnix Command Line Productivity Tips
Unix Command Line Productivity Tips
Keith Bennett
 
LD_PRELOAD Exploitation - DC9723
LD_PRELOAD Exploitation - DC9723LD_PRELOAD Exploitation - DC9723
LD_PRELOAD Exploitation - DC9723
Iftach Ian Amit
 
101 3.2 process text streams using filters
101 3.2 process text streams using filters101 3.2 process text streams using filters
101 3.2 process text streams using filters
Acácio Oliveira
 
101 3.2 process text streams using filters
101 3.2 process text streams using filters101 3.2 process text streams using filters
101 3.2 process text streams using filters
Acácio Oliveira
 
Systemcall1
Systemcall1Systemcall1
Systemcall1
pavimalpani
 
Linux 系統程式--第一章 i/o 函式
Linux 系統程式--第一章 i/o 函式Linux 系統程式--第一章 i/o 函式
Linux 系統程式--第一章 i/o 函式
艾鍗科技
 
intro unix/linux 08
intro unix/linux 08intro unix/linux 08
intro unix/linux 08
duquoi
 
Os lab manual
Os lab manualOs lab manual
Os lab manual
Neelamani Samal
 
Linux basics
Linux basicsLinux basics
Linux basics
sirmanohar
 
Something About Dynamic Linking
Something About Dynamic LinkingSomething About Dynamic Linking
Something About Dynamic Linking
Wang Hsiangkai
 
101 3.2 process text streams using filters
101 3.2 process text streams using filters101 3.2 process text streams using filters
101 3.2 process text streams using filters
Acácio Oliveira
 
L kernel-logging-apis-pdf
L kernel-logging-apis-pdfL kernel-logging-apis-pdf
L kernel-logging-apis-pdf
Susant Sahani
 
Linux commands
Linux commandsLinux commands
Linux commands
bhatvijetha
 
WEB PROGRAMMING UNIT VI BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT VI BY BHAVSINGH MALOTHWEB PROGRAMMING UNIT VI BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT VI BY BHAVSINGH MALOTH
Bhavsingh Maloth
 

What's hot (20)

Unit 7
Unit 7Unit 7
Unit 7
 
The Ring programming language version 1.3 book - Part 60 of 88
The Ring programming language version 1.3 book - Part 60 of 88The Ring programming language version 1.3 book - Part 60 of 88
The Ring programming language version 1.3 book - Part 60 of 88
 
Linux
LinuxLinux
Linux
 
Unix practical file
Unix practical fileUnix practical file
Unix practical file
 
intro unix/linux 10
intro unix/linux 10intro unix/linux 10
intro unix/linux 10
 
Unix(introduction)
Unix(introduction)Unix(introduction)
Unix(introduction)
 
Unix Command Line Productivity Tips
Unix Command Line Productivity TipsUnix Command Line Productivity Tips
Unix Command Line Productivity Tips
 
LD_PRELOAD Exploitation - DC9723
LD_PRELOAD Exploitation - DC9723LD_PRELOAD Exploitation - DC9723
LD_PRELOAD Exploitation - DC9723
 
101 3.2 process text streams using filters
101 3.2 process text streams using filters101 3.2 process text streams using filters
101 3.2 process text streams using filters
 
101 3.2 process text streams using filters
101 3.2 process text streams using filters101 3.2 process text streams using filters
101 3.2 process text streams using filters
 
Systemcall1
Systemcall1Systemcall1
Systemcall1
 
Linux 系統程式--第一章 i/o 函式
Linux 系統程式--第一章 i/o 函式Linux 系統程式--第一章 i/o 函式
Linux 系統程式--第一章 i/o 函式
 
intro unix/linux 08
intro unix/linux 08intro unix/linux 08
intro unix/linux 08
 
Os lab manual
Os lab manualOs lab manual
Os lab manual
 
Linux basics
Linux basicsLinux basics
Linux basics
 
Something About Dynamic Linking
Something About Dynamic LinkingSomething About Dynamic Linking
Something About Dynamic Linking
 
101 3.2 process text streams using filters
101 3.2 process text streams using filters101 3.2 process text streams using filters
101 3.2 process text streams using filters
 
L kernel-logging-apis-pdf
L kernel-logging-apis-pdfL kernel-logging-apis-pdf
L kernel-logging-apis-pdf
 
Linux commands
Linux commandsLinux commands
Linux commands
 
WEB PROGRAMMING UNIT VI BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT VI BY BHAVSINGH MALOTHWEB PROGRAMMING UNIT VI BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT VI BY BHAVSINGH MALOTH
 

Viewers also liked

Unix kernal
Unix kernalUnix kernal
Ch2
Ch2Ch2
Unix Process management
Unix Process managementUnix Process management
Unix Process management
Wave Digitech
 
Commands and shell programming (3)
Commands and shell programming (3)Commands and shell programming (3)
Commands and shell programming (3)
christ university
 
Unix files
Unix filesUnix files
Unix files
Sunil Rm
 
Unit 8
Unit 8Unit 8
Unit 8
siddr
 
NTFS and Inode
NTFS and InodeNTFS and Inode
NTFS and Inode
Amit Seal Ami
 
Usp notes unit6-8
Usp notes unit6-8Usp notes unit6-8
Usp notes unit6-8
Syed Mustafa
 
Processes in unix
Processes in unixProcesses in unix
Processes in unix
miau_max
 
Kernal
KernalKernal
Kernal
Ramasubbu .P
 
How inodes Work
How inodes WorkHow inodes Work
How inodes Work
Roman Tarnavski
 
Unix And Shell Scripting
Unix And Shell ScriptingUnix And Shell Scripting
Unix And Shell Scripting
Jaibeer Malik
 
Creating HTML Pages
Creating HTML PagesCreating HTML Pages
Creating HTML Pages
Mike Crabb
 
What is a Kernel? : Introduction And Architecture
What is a Kernel? : Introduction And ArchitectureWhat is a Kernel? : Introduction And Architecture
What is a Kernel? : Introduction And Architecture
pec2013
 
How We Caffeinate
How We CaffeinateHow We Caffeinate
How We Caffeinate
Food Insight
 

Viewers also liked (15)

Unix kernal
Unix kernalUnix kernal
Unix kernal
 
Ch2
Ch2Ch2
Ch2
 
Unix Process management
Unix Process managementUnix Process management
Unix Process management
 
Commands and shell programming (3)
Commands and shell programming (3)Commands and shell programming (3)
Commands and shell programming (3)
 
Unix files
Unix filesUnix files
Unix files
 
Unit 8
Unit 8Unit 8
Unit 8
 
NTFS and Inode
NTFS and InodeNTFS and Inode
NTFS and Inode
 
Usp notes unit6-8
Usp notes unit6-8Usp notes unit6-8
Usp notes unit6-8
 
Processes in unix
Processes in unixProcesses in unix
Processes in unix
 
Kernal
KernalKernal
Kernal
 
How inodes Work
How inodes WorkHow inodes Work
How inodes Work
 
Unix And Shell Scripting
Unix And Shell ScriptingUnix And Shell Scripting
Unix And Shell Scripting
 
Creating HTML Pages
Creating HTML PagesCreating HTML Pages
Creating HTML Pages
 
What is a Kernel? : Introduction And Architecture
What is a Kernel? : Introduction And ArchitectureWhat is a Kernel? : Introduction And Architecture
What is a Kernel? : Introduction And Architecture
 
How We Caffeinate
How We CaffeinateHow We Caffeinate
How We Caffeinate
 

Similar to Unix processes

Lecture 1_Functions in C.pptx
Lecture 1_Functions in C.pptxLecture 1_Functions in C.pptx
Lecture 1_Functions in C.pptx
KhurramKhan173
 
02 functions, variables, basic input and output of c++
02   functions, variables, basic input and output of c++02   functions, variables, basic input and output of c++
02 functions, variables, basic input and output of c++
Manzoor ALam
 
Python_Functions_Unit1.pptx
Python_Functions_Unit1.pptxPython_Functions_Unit1.pptx
Python_Functions_Unit1.pptx
Koteswari Kasireddy
 
Functions
FunctionsFunctions
Functions
Swarup Boro
 
A closure ekon16
A closure ekon16A closure ekon16
A closure ekon16
Max Kleiner
 
Chapter 1. Functions in C++.pdf
Chapter 1.  Functions in C++.pdfChapter 1.  Functions in C++.pdf
Chapter 1. Functions in C++.pdf
TeshaleSiyum
 
Chapter_1.__Functions_in_C++[1].pdf
Chapter_1.__Functions_in_C++[1].pdfChapter_1.__Functions_in_C++[1].pdf
Chapter_1.__Functions_in_C++[1].pdf
TeshaleSiyum
 
Python programming variables and comment
Python programming variables and commentPython programming variables and comment
Python programming variables and comment
MalligaarjunanN
 
function in in thi pdf you will learn what is fu...
function in  in thi pdf you will learn   what                           is fu...function in  in thi pdf you will learn   what                           is fu...
function in in thi pdf you will learn what is fu...
kushwahashivam413
 
Cs1123 8 functions
Cs1123 8 functionsCs1123 8 functions
Cs1123 8 functions
TAlha MAlik
 
Preprocessor directives
Preprocessor directivesPreprocessor directives
Preprocessor directives
Vikash Dhal
 
The Ring programming language version 1.7 book - Part 83 of 196
The Ring programming language version 1.7 book - Part 83 of 196The Ring programming language version 1.7 book - Part 83 of 196
The Ring programming language version 1.7 book - Part 83 of 196
Mahmoud Samir Fayed
 
Programming Fundamentals Functions in C and types
Programming Fundamentals  Functions in C  and typesProgramming Fundamentals  Functions in C  and types
Programming Fundamentals Functions in C and types
imtiazalijoono
 
Functions2.pptx
Functions2.pptxFunctions2.pptx
Functions2.pptx
AkhilTyagi42
 
Java 8 - functional features
Java 8 - functional featuresJava 8 - functional features
Java 8 - functional features
Rafal Rybacki
 
The Ring programming language version 1.2 book - Part 57 of 84
The Ring programming language version 1.2 book - Part 57 of 84The Ring programming language version 1.2 book - Part 57 of 84
The Ring programming language version 1.2 book - Part 57 of 84
Mahmoud Samir Fayed
 
VLSI Design Final Project - 32 bit ALU
VLSI Design Final Project - 32 bit ALUVLSI Design Final Project - 32 bit ALU
VLSI Design Final Project - 32 bit ALU
Sachin Kumar Asokan
 
Functions part1
Functions part1Functions part1
Functions part1
yndaravind
 
Fnctions part2
Fnctions part2Fnctions part2
Fnctions part2
yndaravind
 
Function
FunctionFunction
Function
yash patel
 

Similar to Unix processes (20)

Lecture 1_Functions in C.pptx
Lecture 1_Functions in C.pptxLecture 1_Functions in C.pptx
Lecture 1_Functions in C.pptx
 
02 functions, variables, basic input and output of c++
02   functions, variables, basic input and output of c++02   functions, variables, basic input and output of c++
02 functions, variables, basic input and output of c++
 
Python_Functions_Unit1.pptx
Python_Functions_Unit1.pptxPython_Functions_Unit1.pptx
Python_Functions_Unit1.pptx
 
Functions
FunctionsFunctions
Functions
 
A closure ekon16
A closure ekon16A closure ekon16
A closure ekon16
 
Chapter 1. Functions in C++.pdf
Chapter 1.  Functions in C++.pdfChapter 1.  Functions in C++.pdf
Chapter 1. Functions in C++.pdf
 
Chapter_1.__Functions_in_C++[1].pdf
Chapter_1.__Functions_in_C++[1].pdfChapter_1.__Functions_in_C++[1].pdf
Chapter_1.__Functions_in_C++[1].pdf
 
Python programming variables and comment
Python programming variables and commentPython programming variables and comment
Python programming variables and comment
 
function in in thi pdf you will learn what is fu...
function in  in thi pdf you will learn   what                           is fu...function in  in thi pdf you will learn   what                           is fu...
function in in thi pdf you will learn what is fu...
 
Cs1123 8 functions
Cs1123 8 functionsCs1123 8 functions
Cs1123 8 functions
 
Preprocessor directives
Preprocessor directivesPreprocessor directives
Preprocessor directives
 
The Ring programming language version 1.7 book - Part 83 of 196
The Ring programming language version 1.7 book - Part 83 of 196The Ring programming language version 1.7 book - Part 83 of 196
The Ring programming language version 1.7 book - Part 83 of 196
 
Programming Fundamentals Functions in C and types
Programming Fundamentals  Functions in C  and typesProgramming Fundamentals  Functions in C  and types
Programming Fundamentals Functions in C and types
 
Functions2.pptx
Functions2.pptxFunctions2.pptx
Functions2.pptx
 
Java 8 - functional features
Java 8 - functional featuresJava 8 - functional features
Java 8 - functional features
 
The Ring programming language version 1.2 book - Part 57 of 84
The Ring programming language version 1.2 book - Part 57 of 84The Ring programming language version 1.2 book - Part 57 of 84
The Ring programming language version 1.2 book - Part 57 of 84
 
VLSI Design Final Project - 32 bit ALU
VLSI Design Final Project - 32 bit ALUVLSI Design Final Project - 32 bit ALU
VLSI Design Final Project - 32 bit ALU
 
Functions part1
Functions part1Functions part1
Functions part1
 
Fnctions part2
Fnctions part2Fnctions part2
Fnctions part2
 
Function
FunctionFunction
Function
 

Recently uploaded

哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
Dr Ramhari Poudyal
 
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
Mukeshwaran Balu
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
awadeshbabu
 
Self-Control of Emotions by Slidesgo.pptx
Self-Control of Emotions by Slidesgo.pptxSelf-Control of Emotions by Slidesgo.pptx
Self-Control of Emotions by Slidesgo.pptx
iemerc2024
 
This is my Environmental physics presentation
This is my Environmental physics presentationThis is my Environmental physics presentation
This is my Environmental physics presentation
ZainabHashmi17
 
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
obonagu
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
jpsjournal1
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
Rahul
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
Kerry Sado
 
digital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdfdigital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdf
drwaing
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
Victor Morales
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
gestioneergodomus
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
ClaraZara1
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
heavyhaig
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
wisnuprabawa3
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
Series of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.pptSeries of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.ppt
PauloRodrigues104553
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 

Recently uploaded (20)

哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
 
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
 
Self-Control of Emotions by Slidesgo.pptx
Self-Control of Emotions by Slidesgo.pptxSelf-Control of Emotions by Slidesgo.pptx
Self-Control of Emotions by Slidesgo.pptx
 
This is my Environmental physics presentation
This is my Environmental physics presentationThis is my Environmental physics presentation
This is my Environmental physics presentation
 
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
 
digital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdfdigital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdf
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
Series of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.pptSeries of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.ppt
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 

Unix processes

  • 1. UNIX PROCESSES 1 Sunil Kumar R.M Assistant Professor RLJIT
  • 2. 2 Sunil Kumar R.M Assistant Professor RLJIT
  • 3. MAIN FUNCTION  PROTOTYPE: int main(int argc, char *argv[ ]); Argc – is the number of command line arguments argv [ ] – is an array of pointers to the arguments 3 Sunil Kumar R.M Assistant Professor RLJIT
  • 4.  A C program is started by a kernel  A special start up routine is called before the main function is called  This start up routine takes values from the kernel and sets things up so that the main function is called 4 Sunil Kumar R.M Assistant Professor RLJIT
  • 5. Process termination  Normal termination * return from main * calling exit * calling _exit  Abnormal termination * calling abort * terminated by a signal 5 Sunil Kumar R.M Assistant Professor RLJIT
  • 6. exit and _exit functions  _exit returns to kernel immediately  exit performs certain cleanup processing and then returns to kernel  PROTOTYPE #include <stdlib.h> void _exit (int status) void exit (int status) 6 Sunil Kumar R.M Assistant Professor RLJIT
  • 7.  The exit status is undefined if 1. Either of these function is called without an exit status 2. Main does a return without a return value 3. Main “falls of the end” 7 Sunil Kumar R.M Assistant Professor RLJIT
  • 8. At exit function  With ANSI C a process can register up to 32 functions that are called by exit ---called exit handlers  Exit handlers are registered by calling the atexit function #include <stdlib.h> Int atexit (void (*clearfun) void)); 8 Sunil Kumar R.M Assistant Professor RLJIT
  • 9.  Atexit function calls these functions in reverse order of their registration  Each function is called as many times as it was registered 9 Sunil Kumar R.M Assistant Professor RLJIT
  • 10. #include "ourhdr.h" static void my_exit1(void), my_exit2(void); int main(void) { if (atexit(my_exit2) != 0) err_sys("can't register my_exit2"); if (atexit(my_exit1) != 0) err_sys("can't register my_exit1"); if (atexit(my_exit1) != 0) err_sys("can't register my_exit1"); printf("main is donen"); return(0); } 10 Sunil Kumar R.M Assistant Professor RLJIT
  • 11. static void my_exit1(void) { printf("first exit handlern"); } static void my_exit2(void) { printf("second exit handlern"); } 11 Sunil Kumar R.M Assistant Professor RLJIT
  • 12. Command-line arguments  /* program to echo command line arguments*/ int main (int argc, char* argv[ ]) { for(int i=0;i<argc ;i++) { printf(“argv[%d]:%s n”,i,argv[i]); } } 12 Sunil Kumar R.M Assistant Professor RLJIT
  • 13. Environment list  Environment list – is an array of character pointers ,where each pointer contains the address of a null terminated C string  The address of array of pointers is contained in global variable environ  extern char **environ;  each string is of the form name=value 13 Sunil Kumar R.M Assistant Professor RLJIT
  • 15. Memory layout of a C program  Text segment – sharable copy  Initialized data segment – variables specifically initialized in the program  Uninitialized data segment – “bss” segment data is initialized to arithematic 0 or null  Stack – return address and information about caller’s environment  Heap – dynamic memory allocation takes place on the heap 15 Sunil Kumar R.M Assistant Professor RLJIT
  • 16. Stack heap Uninitialised data initialised data Text Command line arguments And environment variables Intialized to 0 by exec Read from prog File by exec High address Low address 16 Sunil Kumar R.M Assistant Professor RLJIT
  • 17. The size(1) command reports the sizes (in bytes) of the text, data, and bss segments#include <stdio.h> int main(void) { return 0; } . 17 Sunil Kumar R.M Assistant Professor RLJIT
  • 18. Shared libraries  Shared libraries remove the common library routines from the executable file , instead maintaining a single copy of the library routine some where in memory that all processes reference  Advantage: reduces size of executable file, easy to replace with a newer version  Disadvantage: some- runtime overhead 18 Sunil Kumar R.M Assistant Professor RLJIT
  • 19.  Linking: Here is where all of the object files and any libraries are linked together to make your final program. Note that for static libraries, the actual library is placed in your final program, while for shared libraries, only a reference to the library is placed inside. 19 Sunil Kumar R.M Assistant Professor RLJIT
  • 20. 20 Sunil Kumar R.M Assistant Professor RLJIT
  • 21. Memory allocation  malloc : allocates specified number of bytes of memory  calloc : allocates specified number of objects of specified size  realloc : changes size of previous allocated area 21 Sunil Kumar R.M Assistant Professor RLJIT
  • 22. #include <stdlib.h> void *malloc (size_t size); void *calloc (size_t nobj, size_t size); void *realloc (void *ptr, size_t newsize); realloc may increase or decrease the size of previously allocated area .If it decreases the size no problem occurs But if the size increases then…………. 22 Sunil Kumar R.M Assistant Professor RLJIT
  • 23. 1. Either there is enough space then the memory is reallocated and the same pointer is returned 2. If there is no space then it allocates new area copies the contents of old area to new area frees the old area and returns pointer to the new area 23 Sunil Kumar R.M Assistant Professor RLJIT
  • 24. Alloca function  It is same as malloc but instead of allocating memory from heap, the memory allocated from the stack frame of the current function 24 Sunil Kumar R.M Assistant Professor RLJIT
  • 25. Environment variables  Environment strings are of the form name=value  ANSI C defined functions #include <stdlib.h> char *getenv (const char *name); int putenv (const char *str); int setenv (const char *name, const char *value ,int rewrite); void unsetenv (const char *name); 25 Sunil Kumar R.M Assistant Professor RLJIT
  • 26.  Getenv : fetches a specific value from the environment  Putenv : takes a string of the form name=value , if it already exists then old value is removed  Setenv : sets name to value. If name already exists then a) if rewrite is non zero, then old definition is removed b) if rewrite is zero old definition is retained  Unsetenv : removes any definition of name 26 Sunil Kumar R.M Assistant Professor RLJIT
  • 27.  Removing an environment variable is simple just find the pointer and move all subsequent pointers down one  But while modifying * if size of new value<=size of old value just copy new string over the old string * if new value >oldvalue use malloc obtain room for new string, replace the old pointer in environment list for name with pointer to this malloced area 27 Sunil Kumar R.M Assistant Professor RLJIT
  • 28.  While adding a new name call malloc allocate room for name=value string and copy the string to this area  If it’s the first time a new name is added , use malloc to obtain area for new list of pointers. Copy the old list of pointers to the malloced area and add the new pointer to its end  If its not the first time a new name was added ,then just reallocate area for new pointer since the list is already on the heap 28 Sunil Kumar R.M Assistant Professor RLJIT
  • 29. Set jump and long jump  To transfer control from one function to another we make use of setjmp and longjmp functions #include <stdio.h> int setjmp (jmp_buf env); void longjmp (jmp_buf env, int val); 29 Sunil Kumar R.M Assistant Professor RLJIT
  • 30.  env is of type jmp_buf ,this data type is form of array that is capable of holding all information required to restore the status of the stack to the state when we call longjmp  Val allows us to have more than one longjmp for one setjmp 30 Sunil Kumar R.M Assistant Professor RLJIT
  • 31. #include <stdio.h> #include <stdlib.h> #include <setjmp.h> int main() { int val; jmp_buf env_buffer; /* save calling environment for longjmp */ val = setjmp( env_buffer ); if( val != 0 ) { printf("Returned from a longjmp() with value = %sn", val); exit(0); } 31 Sunil Kumar R.M Assistant Professor RLJIT
  • 32.  printf("Jump function calln"); jmpfunction( env_buffer ); return(0); } void jmpfunction(jmp_buf env_buf) { longjmp(env_buf, “RLJITCSE"); } Output: Jump function call Returned from a longjmp() with value = RLJITCSE 32 Sunil Kumar R.M Assistant Professor RLJIT
  • 33. getrlimit and setrlimit #include <sys/time.h> #include <sys/resource.h> int getrlimit (int resource ,struct rlimit *rlptr); int setrlimit (int resource ,const struct rlimit *rlptr); 33 Sunil Kumar R.M Assistant Professor RLJIT
  • 34. Struct rlimit { rlim_t rlim_cur; /*soft limit*/ rlim_t rlim_max; /*hard limit */ } 1. Soft link can be changed by any process to a value <= to its hard limit 2. Any process can lower its hard limit to a value greater than or equal to its soft limit 3. Only super user can raise hard limit 34 Sunil Kumar R.M Assistant Professor RLJIT
  • 35.  RLIMIT_CORE – max size in bytes of a core file  RLIMIT_CPU – max amount of CPU time in seconds  RLIMIT_DATA – max size in bytes of data segment  RLIMIT_FSIZE – max size in bytes of a file that can be created  RLIMIT_MEMLOCK – locked in-memory address space 35 Sunil Kumar R.M Assistant Professor RLJIT
  • 36.  RLIMIT_NOFILE – max number of open files per process  RLIMIT_NPROC – max number of child process per real user ID  RLIMIT_OFILE – same as RLIMIT_NOFILE  RLIMIT_RSS – max resident set size in bytes  RLIMIT_STACK – max size in bytes of the stack  RLIMIT_VMEM – max size in bytes of the mapped address space 36 Sunil Kumar R.M Assistant Professor RLJIT
  • 37. #include <sys/types.h> #include <sys/time.h> #include <sys/resource.h> #include "ourhdr.h" #define doit(name) pr_limits(#name, name) static voidpr_limits(char *, int); int main(void) { doit(RLIMIT_CORE); doit(RLIMIT_CPU); doit(RLIMIT_DATA); doit(RLIMIT_FSIZE); 37 Sunil Kumar R.M Assistant Professor RLJIT
  • 38. #ifdef RLIMIT_MEMLOCK doit (RLIMIT_MEMLOCK); #endif #ifdef RLIMIT_NOFILE /* SVR4 name */ doit (RLIMIT_NOFILE); #endif #ifdef RLIMIT_OFILE /* 44BSD name */ doit (RLIMIT_OFILE); #endif 38 Sunil Kumar R.M Assistant Professor RLJIT
  • 39. #ifdef RLIMIT_NPROC doit (RLIMIT_NPROC); #endif #ifdef RLIMIT_RSS doit(RLIMIT_RSS); #endif doit(RLIMIT_STACK); #ifdef RLIMIT_VMEM doit(RLIMIT_VMEM); #endif exit(0); } 39 Sunil Kumar R.M Assistant Professor RLJIT
  • 40. static void pr_limits(char *name, int resource) { struct rlimit limit; if (getrlimit(resource, &limit) < 0) err_sys("getrlimit error for %s", name); printf("%-14s ", name); if (limit.rlim_cur == RLIM_INFINITY) printf("(infinite) "); 40 Sunil Kumar R.M Assistant Professor RLJIT
  • 41. else printf("%10ld ", limit.rlim_cur); if (limit.rlim_max == RLIM_INFINITY) printf("(infinite)n"); else printf("%10ldn", limit.rlim_max); } 41 Sunil Kumar R.M Assistant Professor RLJIT
  • 42. Kernel support for processes  File descriptor table Current directory root text data stack Per process u-area Per process region table Kernel region table Process table 42 Sunil Kumar R.M Assistant Professor RLJIT
  • 43.  A process consists of  A text segment – program text of a process in machine executable instruction code format  A data segment – static and global variables in machine executable format  A stack segment – function arguments, automatic variables and return addresses of all active functions of a process at any time  U-area is an extension of Process table entry and contains process-specific data 43 Sunil Kumar R.M Assistant Professor RLJIT
  • 44.  Fd table stack data text stack data File tableparent child Process table Kernel region table Fd table 44 Sunil Kumar R.M Assistant Professor RLJIT
  • 45. Besides open files the other properties inherited by child are  Real user ID, group ID, effective user ID, effective group ID  Supplementary group ID  Process group ID  Session ID  Controlling terminal  set-user-ID and set-group-ID  Current working directory 45 Sunil Kumar R.M Assistant Professor RLJIT
  • 46.  Root directory  Signal handling  Signal mask and dispositions  Umask  Nice value  The difference between the parent & child  The process ID  Parent process ID  File locks  Alarms clock time  Pending signals 46 Sunil Kumar R.M Assistant Professor RLJIT