Chap04(Signals and Sessions).PDF

Similar documents
제1장 Unix란 무엇인가?

Microsoft PowerPoint - 10_Signal

<4D F736F F F696E74202D BDC3B1D7B3CEB0FA20BDC3B1D7B3CE20C3B3B8AE2E707074>

본 강의에 들어가기 전

1장. 유닉스 시스템 프로그래밍 개요

2009년 상반기 사업계획

Microsoft PowerPoint - ch07_시그널 [호환 모드]

6주차.key

좀비프로세스 2

/chroot/lib/ /chroot/etc/

슬라이드 1

System Programming Lab

Microsoft PowerPoint - chap9 [호환 모드]

Chap06(Interprocess Communication).PDF

강의10

ABC 11장

Microsoft PowerPoint - SP6장-시그널.ppt [호환 모드]

K&R2 Reference Manual 번역본

The Pocket Guide to TCP/IP Sockets: C Version

(Asynchronous Mode) ( 1, 5~8, 1~2) & (Parity) 1 ; * S erial Port (BIOS INT 14H) - 1 -

untitled

untitled

untitled

10주차.key

슬라이드 1

Something that can be seen, touched or otherwise sensed

untitled

13주-14주proc.PDF

chap7.key


PowerPoint 프레젠테이션

untitled

PowerPoint 프레젠테이션

À©µµ³×Æ®¿÷ÇÁ·Î±×·¡¹Ö4Àå_ÃÖÁ¾

PowerPoint 프레젠테이션

0. 표지에이름과학번을적으시오. (6) 1. 변수 x, y 가 integer type 이라가정하고다음빈칸에 x 와 y 의계산결과값을적으시오. (5) x = (3 + 7) * 6; x = 60 x = (12 + 6) / 2 * 3; x = 27 x = 3 * (8 / 4

프로그램을 학교 등지에서 조금이라도 배운 사람들을 위한 프로그래밍 노트 입니다. 저 역시 그 사람들 중 하나 입니다. 중고등학교 시절 학교 도서관, 새로 생긴 시립 도서관 등을 다니며 책을 보 고 정리하며 어느정도 독학으르 공부하긴 했지만, 자주 안하다 보면 금방 잊어

컴파일러

Figure 5.01

SIGPLwinterschool2012

1

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션

(Exposure) Exposure (Exposure Assesment) EMF Unknown to mechanism Health Effect (Effect) Unknown to mechanism Behavior pattern (Micro- Environment) Re

Microsoft Word - ASG AT90CAN128 모듈.doc

5.스택(강의자료).key

ecorp-프로젝트제안서작성실무(양식3)

chap10.PDF

PowerPoint 프레젠테이션

untitled

03장.스택.key

untitled

Microsoft PowerPoint - 09-Pipe

C++-¿Ïº®Çؼ³10Àå

PowerPoint 프레젠테이션

제1장 Unix란 무엇인가?

MAX+plus II Getting Started - 무작정따라하기

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션


SRC PLUS 제어기 MANUAL

Mobile Service > IAP > Android SDK [ ] IAP SDK TOAST SDK. IAP SDK. Android Studio IDE Android SDK Version (API Level 10). Name Reference V

Microsoft PowerPoint - Lecture_Note_7.ppt [Compatibility Mode]

본 강의에 들어가기 전

int main(void) int a; int b; a=3; b=a+5; printf("a : %d \n", a); printf("b : %d \n", b); a b 3 a a+5 b &a(12ff60) &b(12ff54) 3 a 8 b printf(" a : %x \

C프로-3장c03逞풚

02 C h a p t e r Java

歯7장.PDF

chap7.PDF

<30362E20C6EDC1FD2DB0EDBFB5B4EBB4D420BCF6C1A42E687770>

歯sql_tuning2

OCaml

Line (A) å j a k= i k #define max(a, b) (((a) >= (b))? (a) : (b)) long MaxSubseqSum0(int A[], unsigned Left, unsigned Right) { int Center, i; long Max

MPLAB C18 C

Microsoft PowerPoint - ch09 - 연결형리스트, Stack, Queue와 응용 pm0100

3. 다음장에나오는 sigprocmask 함수의설명을참고하여다음프로그램의출력물과그출력물이화면이표시되는시점을예측하세요. ( 힌트 : 각줄이표시되는시점은다음 4 가지중하나. (1) 프로그램수행직후, (2) kill 명령실행직후, (3) 15 #include <signal.

11장 포인터

제1장 Unix란 무엇인가?

Index Process Specification Data Dictionary

DE1-SoC Board

Connection 8 22 UniSQLConnection / / 9 3 UniSQL OID SET

Deok9_Exploit Technique

No Slide Title

PowerPoint 프레젠테이션

Microsoft PowerPoint - Chapter_04.pptx


<C1A63130C0E5C7C1B7CEBCBCBDBA2E687770>

PRO1_09E [읽기 전용]

Act84_

Chapter_06

T100MD+

chap8.PDF

민속지_이건욱T 최종

Ä¡¿ì³»ÁöÃÖÁ¾

<B1A4B0EDC8ABBAB8C7D0BAB8392D345F33C2F75F E687770>

원고스타일 정의

4임금연구겨울-지상토론

이번장에서학습할내용 동적메모리란? malloc() 와 calloc() 연결리스트 파일을이용하면보다많은데이터를유용하고지속적으로사용및관리할수있습니다. 2

slide2

<32382DC3BBB0A2C0E5BED6C0DA2E687770>

Transcription:

Signals and Session Management 2002 2 Hyun-Ju Park

(Signal)? Introduction (1) mechanism events : asynchronous events - interrupt signal from users : synchronous events - exceptions (accessing an illegal address) primitive mechanism an integer value which specifies the type of events Signals and Session Management 1

History Introduction (2) Original System V signal unreliable and defective 4.2BSD reliable, robust signal SVR3 System V reliable signal (4.2BSD incompatible) POSIX 1003.1 BSD SVR3 reliable signal Solaris, AIX, HP-UX, 4.4BSD, Digital UNIX UNIX POSIX compliant signal Signals and Session Management 2

Issues Introduction (3)? ( ),???? Signals and Session Management 3

(generation) (delivery) Signal? Original system V defined 15 signals 4BSD and SVR4 define 32 signals (some variants support more than 32 signals) POSIX 1003.1 signal symbolic name 102, 4-1 Signals and Session Management 4

(1), function signal handler default action Signals and Session Management 5

(2) 5 default actions for signals abort : terminate the process after generating a core dump exit : terminates the process without generating a core dump ignore : ignores the signal stop : suspends the process continue : resumes the process, if suspended( or else, ignores the signal) User defined function(signal handler) SIGKILL SIGSTOP ignore, block, signal handler 102, 4-1 Signals and Session Management 6

(3) issig(), issig() issig() TRUE, psig() psig(): sendsig() Signals and Session Management 7

(4) Signal delivered Execute normal code Signal handler runs Resume normal execution Signals and Session Management 8

(1) Major sources of signals (exceptions) (terminal interrupts) (job control) (quotas) (notifications) (alarms) Signals and Session Management 9

(2) kill sigsend Ctrl-C foreground process csh ksh foreground background process Signals and Session Management 10

(3) CPU Signals and Session Management 11

(1) Asynchronous events Ctrl-C foreground process SIGINT, (issig()) Signals and Session Management 12

(2) Synchronous events : exception, issig() Signals and Session Management 13

Sleep and Signals What happens sleeping process receives a signal? Two categories of sleep uninterruptible sleep sleep : mark the signal as pending interruptible sleep : issig() Signals and Session Management 14

Signals in SVR4 (1) Superset of the functionality of SVR3 and BSD signals sigprocmask(int how, const sigset_t * setp, sigset_t *osetp); how: SIG_BLOCK, SIG_UNBLOCK, SIG_SETMASK setp: new mask osetp: old mask if not nonnull pointer sigaltstack(stack, old_stack); sigsuspend(const sigset_t* sigmask); unblocking pause signal atomic operation sigpending(sigset_t* setp); block or pending signal check sigsendset(procset_t* procset, sig); process group sig Signals and Session Management 15

Signals in SVR4 (2) sigaction(int signo, const struct sigaction* act, struct sigaction oact); struct sigaction { } void (*sa_handler) (); /* addr of signal handler, or SIG_IGN, or SIG_DFL*/ sigset_t sa_mask; /* additional signals to block */ int sa_flags; /* signal options */ sa_mask signo act signo Signals and Session Management 16

Signals in SVR4 (3) SVR4 signal implementation BSD u area : contains information required to properly invoke the signal handlers, u_signal[ ]: vector of signal handlers for each signal u_sigmask[ ]: signal masks associated with each handler u_sigaltstack: pointer to the alternate signal stack u_sigonstack: mask of signals to handle on the alternate stack u_oldsig: set of handlers that must exhibit the old, unreliable behavior proc structure : contains fields related to generation and posting of signals p_cursig: current signal being handled p_sig: pending signal mask p_hold: blocked signal mask p_ignore: ignored signal mask Signals and Session Management 17

#include <signal.h> #include <stdio.h> #include <string.h> #include <sys/types.h> #include <unistd.h> void sigusr1_handler (int signal_number) { printf( Ctrl-C!!\n ); printf( --> \n ); exit(1); } int main (void) { struct sigaction sa; memset (&sa, 0, sizeof (sa)); sa.sa_handler =&sigint_handler; sigaction (SIGINT,&sa,NULL); while (1) printf( * ); printf ( \n ); return 0; } Signals and Session Management 18

UNIX, Signals and Session Management 19

(1) (Process groups) ID process group ID event PID ID, /dev/tty Signals and Session Management 20

(2) tty t_pgrp SIGINT, SIGQUIT fg (SIGCONT) Ctrl-Z (SIGTSTP) bg Signals and Session Management 21

SVR3 Process group is the same as a terminal login session P P P P P Process Foreground Process Proces group Login session Signals and Session Management 22

SVR4 Introduces a session structure Session = a collection of process groups P P P P P P Session Object P P Process Foreground Process Proces group Login session Signals and Session Management 23