SlideShare una empresa de Scribd logo
1 de 39
BANGALORE INSTITUTE OF TECHNOLOGY
DEPARTMENT OF INFORMATION SCIENCE & ENGINEERING
SUBMITTED BY:
ANJAN B 1BI20IS016
DASRHAN P 1BI20IS027
LAKSHMISHA R A 1BI20IS049
MANOJ B KULKARNI 1BI20IS052
PRASANNAGOUDA S PATIL 1BI20IS063
Mrs. ANUPAMA K C
ASSISTANT PROFESSOR
DEPT OF ISE , BIT
FACULTY INCHARGE:
SIGNALS , THE UNIX KERNEL SUPPORT FOR SIGNALS
UNIX PROGRAMMING - 18CS56
PRESENTATION ON
INTRODUCTION
 Signals are software versions of hardware interrupts.
 Every signal has a name. These names all begin with the three characters SIG.
 For example, SIGABRT is the abort signal that is generated when a process calls the
abort function.
 A parent & child process can send signals to each other for process synchronization.
 Signals are defined as positive integer flags in the <signal.h> header file.
 No signal has a signal number of 0. We'll see in further slides that the kill function
uses the signal number of 0 for a special case. POSIX.1 calls this value the null signal.
 FreeBSD 5.2.1, Mac OS X 10.3, and Linux 2.4.22 support 31 different signals,
whereas Solaris 9 supports 38 different signals.
 FreeBSD 5.2.1 and Mac OS X 10.3 define the signals in <sys/signal.h>.
 Linux 2.4.22 defines the signals in <bits/signum.h>, and Solaris 9 defines them in
<sys/iso/signal_iso.h>.
CONDITIONS THAT CAN GENERATE SIGNALS
 The terminal-generated signals occur when users press certain terminal keys. Pressing the DELETE
key on the terminal (or Control-C on many systems) normally causes the interrupt signal (SIGINT)
to be generated. This is how to stop a runaway program.
 Hardware exceptions generate signals: divide by 0, invalid memory reference, and the like. These
conditions are usually detected by the hardware, and the kernel is notified. The kernel then
generates the appropriate signal for the process that was running at the time the condition occurred.
For example, SIGSEGV is generated for a process that executes an invalid memory reference.
 The kill(2) function allows a process to send any signal to another process or process
group. Naturally, there are limitations: we have to be the owner of the process that
we're sending the signal to, or we have to be the superuser.
 The kill(1) command allows us to send signals to other processes. This program is just
an interface to the kill function. This command is often used to terminate a runaway
background process.
 Software conditions can generate signals when something happens about which the
process should be notified. These aren't hardware-generated conditions. Examples are
SIGURG (generated when out-of-band data arrives over a network connection),
SIGPIPE (generated when a process writes to a pipe after the reader of the pipe has
terminated)
Contd.
DISPOSITION OF THE SIGNAL
We can tell the kernel to do one of three things when a signal occurs. We call this the disposition of the
signal, or the action associated with a signal.
 Ignore the signal.
 This works for most signals, but two signals can never be ignored: SIGKILL and SIGSTOP.
 The reason these two signals can't be ignored is to provide the kernel and the superuser with a surefire
way of either killing or stopping any process.
 Also, if we ignore some of the signals that are generated by a hardware exception (such as illegal
memory reference or divide by 0), the behavior of the process is undefined.
 Let the default action apply.
 Every signal has a default action.
 Note that the default action for most signals is to terminate the process.
 Catch the signal.
 We tell the kernel to call a function of ours whenever the signal occurs.
 In our function, we can do whatever we want to handle the condition. If we're writing
a command interpreter, for example, when the user generates the interrupt signal at
the keyboard, we probably want to return to the main loop of the program,
terminating whatever command we were executing for the user.
 If the SIGCHLD signal is caught, it means that a child process has terminated, so the
signal-catching function can call waitpid to fetch the child's process ID and
termination status.
 As another example, if the process has created temporary files, we may want to write
a signal-catching function for the SIGTERM signal (the termination signal that is the
default signal sent by the kill command) to clean up the temporary files.
 Note that the two signals SIGKILL and SIGSTOP can't be caught.
Contd.
POSIX – Defined signals
Contd.
Contd.
 In Unix System V 3. cach entry in the kernel process table slot has an array of signal
Nags, one for each defined in the system
 When a signal is generated for a process, the kernel will set the corresponding signal
flag in the process table slot of the recipient process.
 If the recipient process is asleep (waiting a child to terminate or executing pause API)
the kernel will awaken the process by scheduling it.
 When the recipient process runs the kernel will check the process U-area that contains
an array of signal handling specifications, where each entry of the array corresponds to
a signal defined in the system.
 The kernel will consult the array to find out how the process will react to the pending
signal.
 If the array entry contains a zero value, the process will accept the default action of the
signal and the kernel will discard it.
The UNIX Kernal Support For Signals
 If the array entry contains a one value, the process will ignore the signal.
 Finally, if the array entry contains any other value, it is used as the function pointer for
a used defined signal hander routine.
 The kernel will setup the process to execute the function immediately, and the process
will return to its current point of execution (or to some other place if signal hander does
a long jump), if the signal hander does not terminate the process.
 If there are different signals pending on a process, the order in which they are sent to a
recipient process in undefined.
 If multiple instances of a signal are pending on a process, it is implementation -
dependent on whether a single instance or multiple instances of the signal will be
delivered to the process.
 In UNIX System V.3, each signal flag in a process table slot records only whether a
signal is pending, but not how many of them are present.
Contd.
 All Unix Systems and ANSI – C support the signal API, which can be used to define
the per-signal handling method.
 The function prototype of the signal is:
 signal_num is the signal identifier like SIGINT or SIGTERM defined in the <signal.h>
handler is the function pointer of a user defined signal handler function. This function
should take an integer formal argument and does not return any value.
 Example below attempts to catch the SIGTERM, ignores the SIGINT and accepts the
default action of the SIGSEGV signal.
Signals
 The SIG_IGN & SIG_DFL are manifest constants defined in <signal.h>
#define SIG_IGN void(*)(int) 1 //Ignore the signal
#define SIG_DFL void(*)(int) 0 //Default action7.
 The return value of signal API is the previous signal handler for the signal.
 The pause API suspends the calling process until it is interrupted by the signal and the
corresponding signal handler does a return.
 The sigset arguments and return value is the same as that of signal.
 Both the functions set signal handling methods for any named signal, but signal API is
unreliable and sigset is reliable.
 this means that when a signal is set to be caught by a signal handler via sigset when
multiple instances of the signal arrive one of them is handled while other instances are
blocked. Further the signal handler is not reset to SIG_DFT when it is invoked.
 UNIX system V.3 and V.4 support the sigset API, which has the same prototype and
similar use a signal.
Calculating letter frequencies
Archiving old files automatically
Extracting system hardware info.
Encryption and Decryption of files
Guessing a number
Questions with answers
1)
Unixppt (1) (1).pptx
Unixppt (1) (1).pptx

Más contenido relacionado

Similar a Unixppt (1) (1).pptx

07 Systems Software Programming-IPC-Signals.pptx
07 Systems Software Programming-IPC-Signals.pptx07 Systems Software Programming-IPC-Signals.pptx
07 Systems Software Programming-IPC-Signals.pptxKushalSrivastava23
 
The Ring programming language version 1.6 book - Part 83 of 189
The Ring programming language version 1.6 book - Part 83 of 189The Ring programming language version 1.6 book - Part 83 of 189
The Ring programming language version 1.6 book - Part 83 of 189Mahmoud Samir Fayed
 
Wireless Ad Hoc Networks
Wireless Ad Hoc NetworksWireless Ad Hoc Networks
Wireless Ad Hoc NetworksTara Hardin
 
6. introduction to digital electronics
6. introduction to digital electronics6. introduction to digital electronics
6. introduction to digital electronicsSajjad Mehmood
 
Lab report 201001067_201001104
Lab report 201001067_201001104Lab report 201001067_201001104
Lab report 201001067_201001104swena_gupta
 
Lab report 201001067_201001104
Lab report 201001067_201001104Lab report 201001067_201001104
Lab report 201001067_201001104swena_gupta
 
Lab report 201001067_201001104
Lab report 201001067_201001104Lab report 201001067_201001104
Lab report 201001067_201001104swena_gupta
 
NetSIm Technology Library- Cognitive radio
NetSIm Technology Library- Cognitive radioNetSIm Technology Library- Cognitive radio
NetSIm Technology Library- Cognitive radioVishal Sharma
 
Project_report_on_Attendance_system
 Project_report_on_Attendance_system Project_report_on_Attendance_system
Project_report_on_Attendance_systemAmi Goswami
 
arduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdfarduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdfssusere5db05
 

Similar a Unixppt (1) (1).pptx (20)

Erlang real time
Erlang real timeErlang real time
Erlang real time
 
Signal
SignalSignal
Signal
 
07 Systems Software Programming-IPC-Signals.pptx
07 Systems Software Programming-IPC-Signals.pptx07 Systems Software Programming-IPC-Signals.pptx
07 Systems Software Programming-IPC-Signals.pptx
 
Dsp class 1
Dsp class 1Dsp class 1
Dsp class 1
 
MyShell - English
MyShell - EnglishMyShell - English
MyShell - English
 
The Ring programming language version 1.6 book - Part 83 of 189
The Ring programming language version 1.6 book - Part 83 of 189The Ring programming language version 1.6 book - Part 83 of 189
The Ring programming language version 1.6 book - Part 83 of 189
 
Wireless Ad Hoc Networks
Wireless Ad Hoc NetworksWireless Ad Hoc Networks
Wireless Ad Hoc Networks
 
Dsp Datapath
Dsp DatapathDsp Datapath
Dsp Datapath
 
6. introduction to digital electronics
6. introduction to digital electronics6. introduction to digital electronics
6. introduction to digital electronics
 
Lab report 201001067_201001104
Lab report 201001067_201001104Lab report 201001067_201001104
Lab report 201001067_201001104
 
Lab report 201001067_201001104
Lab report 201001067_201001104Lab report 201001067_201001104
Lab report 201001067_201001104
 
Lab report 201001067_201001104
Lab report 201001067_201001104Lab report 201001067_201001104
Lab report 201001067_201001104
 
dsp.pdf
dsp.pdfdsp.pdf
dsp.pdf
 
Interrupts
InterruptsInterrupts
Interrupts
 
NetSIm Technology Library- Cognitive radio
NetSIm Technology Library- Cognitive radioNetSIm Technology Library- Cognitive radio
NetSIm Technology Library- Cognitive radio
 
Real time signal processing
Real time signal processingReal time signal processing
Real time signal processing
 
Project_report_on_Attendance_system
 Project_report_on_Attendance_system Project_report_on_Attendance_system
Project_report_on_Attendance_system
 
Lec2
Lec2Lec2
Lec2
 
arduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdfarduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdf
 
Arduino course
Arduino courseArduino course
Arduino course
 

Último

一比一定(购)新西兰林肯大学毕业证(Lincoln毕业证)成绩单学位证
一比一定(购)新西兰林肯大学毕业证(Lincoln毕业证)成绩单学位证一比一定(购)新西兰林肯大学毕业证(Lincoln毕业证)成绩单学位证
一比一定(购)新西兰林肯大学毕业证(Lincoln毕业证)成绩单学位证wpkuukw
 
➥🔝 7737669865 🔝▻ kakinada Call-girls in Women Seeking Men 🔝kakinada🔝 Escor...
➥🔝 7737669865 🔝▻ kakinada Call-girls in Women Seeking Men  🔝kakinada🔝   Escor...➥🔝 7737669865 🔝▻ kakinada Call-girls in Women Seeking Men  🔝kakinada🔝   Escor...
➥🔝 7737669865 🔝▻ kakinada Call-girls in Women Seeking Men 🔝kakinada🔝 Escor...amitlee9823
 
Shikrapur Call Girls Most Awaited Fun 6297143586 High Profiles young Beautie...
Shikrapur Call Girls Most Awaited Fun  6297143586 High Profiles young Beautie...Shikrapur Call Girls Most Awaited Fun  6297143586 High Profiles young Beautie...
Shikrapur Call Girls Most Awaited Fun 6297143586 High Profiles young Beautie...tanu pandey
 
Book Paid Lohegaon Call Girls Pune 8250192130Low Budget Full Independent High...
Book Paid Lohegaon Call Girls Pune 8250192130Low Budget Full Independent High...Book Paid Lohegaon Call Girls Pune 8250192130Low Budget Full Independent High...
Book Paid Lohegaon Call Girls Pune 8250192130Low Budget Full Independent High...ranjana rawat
 
Escorts Service Daryaganj - 9899900591 College Girls & Models 24/7
Escorts Service Daryaganj - 9899900591 College Girls & Models 24/7Escorts Service Daryaganj - 9899900591 College Girls & Models 24/7
Escorts Service Daryaganj - 9899900591 College Girls & Models 24/7shivanni mehta
 
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Th...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Th...Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Th...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Th...Pooja Nehwal
 
Bommasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Bommasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Bommasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Bommasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...amitlee9823
 
NO1 Verified Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi A...
NO1 Verified Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi A...NO1 Verified Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi A...
NO1 Verified Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi A...Amil baba
 
Top Rated Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated  Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Top Rated  Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Call Girls in Nagpur High Profile
 
Call Girls In RT Nagar ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In RT Nagar ☎ 7737669865 🥵 Book Your One night StandCall Girls In RT Nagar ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In RT Nagar ☎ 7737669865 🥵 Book Your One night Standamitlee9823
 
(👉Ridhima)👉VIP Model Call Girls Mulund ( Mumbai) Call ON 9967824496 Starting ...
(👉Ridhima)👉VIP Model Call Girls Mulund ( Mumbai) Call ON 9967824496 Starting ...(👉Ridhima)👉VIP Model Call Girls Mulund ( Mumbai) Call ON 9967824496 Starting ...
(👉Ridhima)👉VIP Model Call Girls Mulund ( Mumbai) Call ON 9967824496 Starting ...motiram463
 
Call Girls Kothrud Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Kothrud Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Kothrud Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Kothrud Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Call Girls Pimple Saudagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Pimple Saudagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Pimple Saudagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Pimple Saudagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Introduction-to-4x4-SRAM-Memory-Block.pptx
Introduction-to-4x4-SRAM-Memory-Block.pptxIntroduction-to-4x4-SRAM-Memory-Block.pptx
Introduction-to-4x4-SRAM-Memory-Block.pptxJaiLegal
 
Call Girls Chickpet ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Call Girls Chickpet ☎ 7737669865☎ Book Your One night Stand (Bangalore)Call Girls Chickpet ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Call Girls Chickpet ☎ 7737669865☎ Book Your One night Stand (Bangalore)amitlee9823
 
Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...amitlee9823
 
Top Rated Pune Call Girls Shirwal ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...
Top Rated  Pune Call Girls Shirwal ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...Top Rated  Pune Call Girls Shirwal ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...
Top Rated Pune Call Girls Shirwal ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...Call Girls in Nagpur High Profile
 

Último (20)

一比一定(购)新西兰林肯大学毕业证(Lincoln毕业证)成绩单学位证
一比一定(购)新西兰林肯大学毕业证(Lincoln毕业证)成绩单学位证一比一定(购)新西兰林肯大学毕业证(Lincoln毕业证)成绩单学位证
一比一定(购)新西兰林肯大学毕业证(Lincoln毕业证)成绩单学位证
 
➥🔝 7737669865 🔝▻ kakinada Call-girls in Women Seeking Men 🔝kakinada🔝 Escor...
➥🔝 7737669865 🔝▻ kakinada Call-girls in Women Seeking Men  🔝kakinada🔝   Escor...➥🔝 7737669865 🔝▻ kakinada Call-girls in Women Seeking Men  🔝kakinada🔝   Escor...
➥🔝 7737669865 🔝▻ kakinada Call-girls in Women Seeking Men 🔝kakinada🔝 Escor...
 
Shikrapur Call Girls Most Awaited Fun 6297143586 High Profiles young Beautie...
Shikrapur Call Girls Most Awaited Fun  6297143586 High Profiles young Beautie...Shikrapur Call Girls Most Awaited Fun  6297143586 High Profiles young Beautie...
Shikrapur Call Girls Most Awaited Fun 6297143586 High Profiles young Beautie...
 
Book Paid Lohegaon Call Girls Pune 8250192130Low Budget Full Independent High...
Book Paid Lohegaon Call Girls Pune 8250192130Low Budget Full Independent High...Book Paid Lohegaon Call Girls Pune 8250192130Low Budget Full Independent High...
Book Paid Lohegaon Call Girls Pune 8250192130Low Budget Full Independent High...
 
CHEAP Call Girls in Vinay Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Vinay Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Vinay Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Vinay Nagar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Escorts Service Daryaganj - 9899900591 College Girls & Models 24/7
Escorts Service Daryaganj - 9899900591 College Girls & Models 24/7Escorts Service Daryaganj - 9899900591 College Girls & Models 24/7
Escorts Service Daryaganj - 9899900591 College Girls & Models 24/7
 
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Th...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Th...Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Th...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Th...
 
Bommasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Bommasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Bommasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Bommasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
 
NO1 Verified Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi A...
NO1 Verified Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi A...NO1 Verified Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi A...
NO1 Verified Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi A...
 
Top Rated Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated  Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Top Rated  Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
 
Call Girls In RT Nagar ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In RT Nagar ☎ 7737669865 🥵 Book Your One night StandCall Girls In RT Nagar ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In RT Nagar ☎ 7737669865 🥵 Book Your One night Stand
 
(👉Ridhima)👉VIP Model Call Girls Mulund ( Mumbai) Call ON 9967824496 Starting ...
(👉Ridhima)👉VIP Model Call Girls Mulund ( Mumbai) Call ON 9967824496 Starting ...(👉Ridhima)👉VIP Model Call Girls Mulund ( Mumbai) Call ON 9967824496 Starting ...
(👉Ridhima)👉VIP Model Call Girls Mulund ( Mumbai) Call ON 9967824496 Starting ...
 
(INDIRA) Call Girl Napur Call Now 8617697112 Napur Escorts 24x7
(INDIRA) Call Girl Napur Call Now 8617697112 Napur Escorts 24x7(INDIRA) Call Girl Napur Call Now 8617697112 Napur Escorts 24x7
(INDIRA) Call Girl Napur Call Now 8617697112 Napur Escorts 24x7
 
Call Girls Kothrud Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Kothrud Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Kothrud Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Kothrud Call Me 7737669865 Budget Friendly No Advance Booking
 
CHEAP Call Girls in Hauz Quazi (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Hauz Quazi  (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Hauz Quazi  (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Hauz Quazi (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Call Girls Pimple Saudagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Pimple Saudagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Pimple Saudagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Pimple Saudagar Call Me 7737669865 Budget Friendly No Advance Booking
 
Introduction-to-4x4-SRAM-Memory-Block.pptx
Introduction-to-4x4-SRAM-Memory-Block.pptxIntroduction-to-4x4-SRAM-Memory-Block.pptx
Introduction-to-4x4-SRAM-Memory-Block.pptx
 
Call Girls Chickpet ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Call Girls Chickpet ☎ 7737669865☎ Book Your One night Stand (Bangalore)Call Girls Chickpet ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Call Girls Chickpet ☎ 7737669865☎ Book Your One night Stand (Bangalore)
 
Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
Kothanur Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
 
Top Rated Pune Call Girls Shirwal ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...
Top Rated  Pune Call Girls Shirwal ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...Top Rated  Pune Call Girls Shirwal ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...
Top Rated Pune Call Girls Shirwal ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...
 

Unixppt (1) (1).pptx

  • 1. BANGALORE INSTITUTE OF TECHNOLOGY DEPARTMENT OF INFORMATION SCIENCE & ENGINEERING SUBMITTED BY: ANJAN B 1BI20IS016 DASRHAN P 1BI20IS027 LAKSHMISHA R A 1BI20IS049 MANOJ B KULKARNI 1BI20IS052 PRASANNAGOUDA S PATIL 1BI20IS063 Mrs. ANUPAMA K C ASSISTANT PROFESSOR DEPT OF ISE , BIT FACULTY INCHARGE: SIGNALS , THE UNIX KERNEL SUPPORT FOR SIGNALS UNIX PROGRAMMING - 18CS56 PRESENTATION ON
  • 2. INTRODUCTION  Signals are software versions of hardware interrupts.  Every signal has a name. These names all begin with the three characters SIG.  For example, SIGABRT is the abort signal that is generated when a process calls the abort function.  A parent & child process can send signals to each other for process synchronization.  Signals are defined as positive integer flags in the <signal.h> header file.  No signal has a signal number of 0. We'll see in further slides that the kill function uses the signal number of 0 for a special case. POSIX.1 calls this value the null signal.  FreeBSD 5.2.1, Mac OS X 10.3, and Linux 2.4.22 support 31 different signals, whereas Solaris 9 supports 38 different signals.  FreeBSD 5.2.1 and Mac OS X 10.3 define the signals in <sys/signal.h>.  Linux 2.4.22 defines the signals in <bits/signum.h>, and Solaris 9 defines them in <sys/iso/signal_iso.h>.
  • 3. CONDITIONS THAT CAN GENERATE SIGNALS  The terminal-generated signals occur when users press certain terminal keys. Pressing the DELETE key on the terminal (or Control-C on many systems) normally causes the interrupt signal (SIGINT) to be generated. This is how to stop a runaway program.  Hardware exceptions generate signals: divide by 0, invalid memory reference, and the like. These conditions are usually detected by the hardware, and the kernel is notified. The kernel then generates the appropriate signal for the process that was running at the time the condition occurred. For example, SIGSEGV is generated for a process that executes an invalid memory reference.
  • 4.  The kill(2) function allows a process to send any signal to another process or process group. Naturally, there are limitations: we have to be the owner of the process that we're sending the signal to, or we have to be the superuser.  The kill(1) command allows us to send signals to other processes. This program is just an interface to the kill function. This command is often used to terminate a runaway background process.  Software conditions can generate signals when something happens about which the process should be notified. These aren't hardware-generated conditions. Examples are SIGURG (generated when out-of-band data arrives over a network connection), SIGPIPE (generated when a process writes to a pipe after the reader of the pipe has terminated) Contd.
  • 5. DISPOSITION OF THE SIGNAL We can tell the kernel to do one of three things when a signal occurs. We call this the disposition of the signal, or the action associated with a signal.  Ignore the signal.  This works for most signals, but two signals can never be ignored: SIGKILL and SIGSTOP.  The reason these two signals can't be ignored is to provide the kernel and the superuser with a surefire way of either killing or stopping any process.  Also, if we ignore some of the signals that are generated by a hardware exception (such as illegal memory reference or divide by 0), the behavior of the process is undefined.  Let the default action apply.  Every signal has a default action.  Note that the default action for most signals is to terminate the process.
  • 6.  Catch the signal.  We tell the kernel to call a function of ours whenever the signal occurs.  In our function, we can do whatever we want to handle the condition. If we're writing a command interpreter, for example, when the user generates the interrupt signal at the keyboard, we probably want to return to the main loop of the program, terminating whatever command we were executing for the user.  If the SIGCHLD signal is caught, it means that a child process has terminated, so the signal-catching function can call waitpid to fetch the child's process ID and termination status.  As another example, if the process has created temporary files, we may want to write a signal-catching function for the SIGTERM signal (the termination signal that is the default signal sent by the kill command) to clean up the temporary files.  Note that the two signals SIGKILL and SIGSTOP can't be caught. Contd.
  • 10.  In Unix System V 3. cach entry in the kernel process table slot has an array of signal Nags, one for each defined in the system  When a signal is generated for a process, the kernel will set the corresponding signal flag in the process table slot of the recipient process.  If the recipient process is asleep (waiting a child to terminate or executing pause API) the kernel will awaken the process by scheduling it.  When the recipient process runs the kernel will check the process U-area that contains an array of signal handling specifications, where each entry of the array corresponds to a signal defined in the system.  The kernel will consult the array to find out how the process will react to the pending signal.  If the array entry contains a zero value, the process will accept the default action of the signal and the kernel will discard it. The UNIX Kernal Support For Signals
  • 11.  If the array entry contains a one value, the process will ignore the signal.  Finally, if the array entry contains any other value, it is used as the function pointer for a used defined signal hander routine.  The kernel will setup the process to execute the function immediately, and the process will return to its current point of execution (or to some other place if signal hander does a long jump), if the signal hander does not terminate the process.  If there are different signals pending on a process, the order in which they are sent to a recipient process in undefined.  If multiple instances of a signal are pending on a process, it is implementation - dependent on whether a single instance or multiple instances of the signal will be delivered to the process.  In UNIX System V.3, each signal flag in a process table slot records only whether a signal is pending, but not how many of them are present. Contd.
  • 12.  All Unix Systems and ANSI – C support the signal API, which can be used to define the per-signal handling method.  The function prototype of the signal is:  signal_num is the signal identifier like SIGINT or SIGTERM defined in the <signal.h> handler is the function pointer of a user defined signal handler function. This function should take an integer formal argument and does not return any value.  Example below attempts to catch the SIGTERM, ignores the SIGINT and accepts the default action of the SIGSEGV signal. Signals
  • 13.  The SIG_IGN & SIG_DFL are manifest constants defined in <signal.h> #define SIG_IGN void(*)(int) 1 //Ignore the signal #define SIG_DFL void(*)(int) 0 //Default action7.  The return value of signal API is the previous signal handler for the signal.  The pause API suspends the calling process until it is interrupted by the signal and the corresponding signal handler does a return.
  • 14.  The sigset arguments and return value is the same as that of signal.  Both the functions set signal handling methods for any named signal, but signal API is unreliable and sigset is reliable.  this means that when a signal is set to be caught by a signal handler via sigset when multiple instances of the signal arrive one of them is handled while other instances are blocked. Further the signal handler is not reset to SIG_DFT when it is invoked.  UNIX system V.3 and V.4 support the sigset API, which has the same prototype and similar use a signal.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21. Archiving old files automatically
  • 22.
  • 23.
  • 24.
  • 25.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 34.
  • 36.