Buscar
Estás en modo de exploración. debe iniciar sesión para usar MEMORY

   Inicia sesión para empezar

level: UNIX_7

Questions and Answers List

level questions: UNIX_7

QuestionAnswer
function for creating new processesfork() child is almost the same as parent returns child ID in parent returns 0 in child returns -1 on error
formula for number of processes created2^n n-number of times we call fork()
function replaces the current process with a new programexec(); program changes while process remains
How the root process is called?init is the first process initialized if a parent dies ten children are adopted by init ID=1 in linux: init=systemd
returns the process ID of the parent of the calling processgetppid()
returns the process ID of the calling processgetpid();
what is zombie prcoessA zombie process is a process whose execution is completed but it still has an entry in the process table. Zombie processes don't use any system resources but they do retain their process ID. init adopts all the zombies
What are process groupsProcesses started by a single command are organized into groups Processes are free to migrate to ther groups or start new ones setpgid() setpgrp()
What are sessionsOne or more process groups can form a session Unix shells create one session per login Processes cannot migrate to other sessions, yet they can start new sessions setsid()
What is job controlGratning controlling terminal access to process groups in a session
command that shows running processes as a treepstree pstree -p -includes PIDs after each process name
command for printing statistics of running processesps ps -ef -full listing on every process
command that prints PID od a processpgrep process_name
command that displays dynamic, real time information on running proceessestop htop -improved version of top
In which file system can we access information on given process?/proc/<PID>/ directory
What are signals?Signals are the simples communication method. No data except signal type is deliver to a process They notify about system events
Who can root send signals to? Who can non-root process send signal to?root can send signal to every process non-root can send only signals to processes running on behalf of the same user
How many signals are defined?28
Do we have user defined signals on unix?Yes 2 SIGUSR1 SIGUSR2
Can signals be blocked, ignored or intercepted?Yes, expcept for two: SIGKILL SIGSTOP they can not be
What happens with blocked signalas?They are postponed, not deliver until unblocked
What happens with ignored signals?They wont be delivered to process
What happens with signals that are not blocked nor ignored?They interrupt current proces or function execution
What is a signal handler?It is a short function invoked when receiving a signal
What happens if no signal handler is defined?default action in most cases process termination
Signal clasification by originnatural-genrated by some event synthetic-by calling a system call every natural signal can be generated synthetically SIGUSR1 SIGUSR2 can be generated synthetically only
How to terminate a process using signal? Which command is used?Kill command sends a signal to a process which terminates the process. If the user doesn’t specify any signal which is to be sent along with kill command then default SIGTERM signal is sent that terminates the process. kill [signal type] <PID> where PID stands for process ID
What is the difference between terminating stopping pocess?terminating results in calling exit() and changing process to dead stopping means freezing, the execution is suspended it still occupies resources
displays status of all jobs in current sessionjobs
How to start process in the background?process_name &
command used to place foreground job in the backgroundbg
command used to place a job in foregroundfg
What is process tracingTool for tracing and displaying all system calls made by a process
How to trace a process>strace