Microsoft PowerPoint - Chapter_02.pptx

Size: px
Start display at page:

Download "Microsoft PowerPoint - Chapter_02.pptx"

Transcription

1 1 Task Management March, 2016 Dept. of software Dankook University

2 Program & Process 2

3 Task, Process and Thread 3 Process Thread

4 Task, Process and Thread 4 Process Thread - 실행상태에있는프로그램의 instance - 자원소유권의단위 - - 디스패칭의단위 - 실행흐름 - 수행의단위 -

5 Task, Process and Thread 5 Process Thread - 실행상태에있는프로그램의 instance - 자원소유권의단위 - - 디스패칭의단위 - 실행흐름 - 수행의단위 - A B

6 Task, Process and Thread 6 Process Thread - 실행상태에있는프로그램의 instance - 자원소유권의단위 - - 디스패칭의단위 - 실행흐름 - 수행의단위 - fork or vfork clone or pthread_create A B

7 Task, Process and Thread 7 A B

8 Task, Process and Thread 8 1. PID A PID B PID

9 Task, Process and Thread 9 1. PID 2. POSIX: 한 process 내의 thread 는동일한 PID 를공유해야한다 A PID TGID B PID TGID

10 Task example - fork 10 #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <linux/unistd.h> int main(void) { int pid; } printf("before fork n n"); if((pid = fork()) < 0){ printf("fork error n"); exit(-2); }else if (pid == 0){ printf( TGID(%d), PID(%d): Child n", getpid(), syscall( NR_gettid)); }else{ printf("tgid(%d), PID(%d): Parent n", getpid(), syscall( NR_gettid)); sleep(2); } printf( after fork n n ); return 0;

11 Task example - pthread 11 #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <linux/unistd.h> void *t_function(void *data) { int id; int i=0; pthread_t t_id; id = *((int *)data); printf( TGID(%d), PID(%d), pthread_self(%d): Child n", getpid(), syscall( NR_gettid), pthread_self()); sleep(2); } int main() { pthread_t p_thread[2]; int thr_id; int status; int a = 1; int b = 2; printf("before pthread_create() n"); if((thr_id = pthread_create(&p_thread[0], NULL, t_function, (void*)&a)) < 0){ perror("thread create error : "); exit(1); } if((thr_id = pthread_create(&p_thread[1], NULL, t_function, (void*)&b)) < 0){ perror("thread create error : "); exit(2); } pthread_join(p_thread[0], (void **)&status); printf("thread join : %d n", status); pthread_join(p_thread[1], (void **)&status); printf("thread join : %d n", status); } printf( TGID(%d), PID(%d): Parent n", getpid(), syscall( NR_gettid)); return 0;

12 Task example - vfork 12 #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <linux/unistd.h> int main(void) { pid_t pid; printf("before vfork n"); } if((pid = vfork()) < 0){ printf("fork error n"); exit(-2); }else if (pid == 0){ printf( TGID(%d), PID(%d): Child n", getpid(), syscall( NR_gettid)); _exit(0); }else{ printf( TGID(%d), PID(%d): Parent n", getpid(), syscall( NR_gettid)); } printf( after vfork n n ); exit(0);

13 Task example - clone 13 #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <linux/unistd.h> #include <sched.h> int sub_a(void *arg) { printf( TGID(%d), PID(%d): Child n", getpid(), syscall( NR_gettid)); sleep(2); return 0; } int main(void) { int child_a_stack[4096], child_b_stack[4096]; printf( before clone n"); printf( TGID(%d), PID(%d) n", getpid(), syscall( NR_gettid)); CLONE_THREAD option 추가시같은 tgid 를가짐 } clone (sub_a, (void *)(child_a_stack+4095), CLONE_CHILD_CLEARTID CLONE_CHILD_SETTID, NULL); clone (sub_a, (void *)(child_b_stack+4095), CLONE_CHILD_CLEARTID CLONE_CHILD_SETTID, NULL); sleep(1); printf( after clone n n ); return 0;

14 Flow controls Task implementation in Linux 14 User App Library System call fork() fork() clone() sys_clone() vfork() vfork() vfork() sys_vfork() clone() clone() clone() sys_fork() pthread_create() pthread_create() clone() User Level Kernel Level do_fork() Using strace, ltrace, ctags and cscope kernel_thread()

15 Task example kernel thread 15 int init module_thread_init(void); void exit module_thread_exit(void); void test_kernel_thread(void *arg){ int val, i, j; val = (int)(long)arg; printk("<0>kernel_thread %d CPU : %d n", val, smp_processor_id()); for(j=0 ; j < ; j++); for(i=0 ; i < ; i++); printk("<0>kernel_thread %d CPU : %d n", val, smp_processor_id()); } int init module_thread_init(){ } int i; for(i = 0 ; i < 4 ; i++) kernel_thread((int (*)(void *))test_kernel_thread, (void *)(long)i, 0); return 0; void exit module_thread_exit(){ printk("<0>module Thread Test Exit n"); } module_init(module_thread_init); module_exit(module_thread_exit);

16 Task example kernel thread 16 obj-m KDIR PWD default: clean: := module_thread.o := /lib/modules/$(shell uname -r)/build := $(shell pwd) $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules rm -rf *.ko rm -rf *.mod.* rm -rf.*.cmd rm -rf *.o

17 Task, Process and Thread PID 2. POSIX: 한 process 내의 thread 는동일한 PID 를공유해야한다 Task A PID TGID Task B PID TGID

18 Task, Process and Thread 18 struct task_struct { pid, tgid, Task A PID TGID Task B PID TGID

19 Linux Thread Model 19 Internal structure : Process : Thread Process A Process B Process C : task_struct 구조체 : Process Discriptor(8KB) ( 프로세스디스크립터 + 커널모드스택 ) : 커널모드스택 User Level Kernel Level task_struct task_struct task_struct task_struct task_struct task_struct task_struct Kernel Thread A task_struct Kernel Thread B task_struct Scheduler

20 문맥 (Context) : Context 커널이관리하는태스크의자원과수행환경집합 3 부분으로구성 : 시스템문맥 (system context), 메모리문맥 (memory context), 하드웨어문맥 (hardware context) memory system context task structure segment table page table 20 file table fd thread structure eip sp eflags eax cs hardware context (TSS) swap or a.out disk memory context

21 System Context 21 태스크를관리하는정보집합 태스크정보 : pid, uid, euid, suid, 태스크상태 : 실행상태, READY 상태, 수면상태, 태스크의가족관계 : p_pptr, p_cptr, next_task, next_run 스케줄링정보 : policy, priority, counter, rt_priority, need_resched 태스크가접근한파일정보 : file descriptor 시그널정보그외 : 수행시간정보, 수행파일이름, 등등 (kernel dependent)

22 태스크생성과전이 ( 커널수준으로진입 / 수면 ) 의예 22 /* test.c */ int glob = 6; char buf[] = a write to stdout n ; int main(void) { int var; pid_t pid; var = 88; write(stdout_fileno, buf, sizeof(buf)-1); printf( before fork n ); if ((pid = fork()) == 0) { /* child */ glob++; var++; } else sleep(2); /* parent */ printf( pid = %d, glob = %d, var = %d n, getpid(), glob, var); exit (0); } (Source : Adv. programming in the UNIX Env., pgm 8.1)

23 Task 생성과주소공간예제결과 23

24 Process State Diagram(1/2) 24 New Exit Admit dispatch Release Ready Running Event Occurs Time-Out Event Wait Blocked Five-State Process Model (Source : OS(stallings))

25 Process State Diagram(2/2) 25 fork initial (idle) running exit zombie wait fork switch sleep, lock ready wakeup, unlock sleep swap swap suspended ready suspended sleep (Source : UNIX Internals)

26 Task State Diagram of LINUX(2.4) 26 create wait signal TASK_STOPPED signal TASK_ZOMBIE schedule exit TASK_RUNNING (ready) TASK_RUNNING (running) preempt Event Occurs Event Wait TASK_INTERRUPTIBLE TASK_UNINTERRUPTIBLE

27 Task State Diagram of LINUX(2.6) 27 create TASK_STOPPED signal TASK_TRACED signal EXIT_ZOMBIE wait schedule exit EXIT_DEAD TASK_RUNNING (ready) TASK_RUNNING (running) preempt Event Occurs Event Wait TASK_INTERRUPTIBLE TASK_UNINTERRUPTIBLE

28 Task State Diagram of LINUX(3.18) 28 fork TASK_WAKING signal TASK_STOPPED TASK_TRACED schedule signal TASK_DEAD EXIT_ZOMBIE exit wait TASK_RUNNING (ready) TASK_RUNNING (running) TASK_DEAD preempt EXIT_DEAD TASK_WAKING event occur TASK_INTERRUPTIBLE TASK_UNINTERRUPTIBLE TASK_KILLABLE event wait

29 Memory Context (1/5) 29 fork internal : compile results gcc test.c header movl %eax, [glob] addl %eax, 1 movl [glob], %eax... 0xffffffff 0xbfffffff kernel stack text data bss stack glob, buf var, pid 0x0 data text user s perspective (virtual memory) a.out : (ELF format) /*include/linux/elf.h */

30 Memory Context (2/5) 30 fork internal : after loading (after run a.out) & before fork task_struct pid = 11 segment table (vm_area_struct) memory text var, pid stack data glob, buf In this figure, we assume that there is no paging mechanism.

31 Memory Context (3/5) 31 fork internal : after fork memory glob, buf task_struct pid = 11 segment data text var, pid stack task_struct pid = 12 segment data glob, buf var, pid stack address space : basic protection barrier

32 Memory Context (4/5) 32 fork internal : with COW (Copy on Write) mechanism after fork with COW after glob++ operation task_struct segment task_struct segment data pid = 11 text pid = 11 text stack stack task_struct segment task_struct segment pid = 12 data pid = 12 data memory memory

33 Memory Context (5/5) 33 새로운프로그램수행 : execve() internal memory task_struct pid = 11 segment data text stack text data a.out header text data bss stack stack

34 Virtual Memory Describing 34 메모리관리자료구조 include/linux/sched.h, include/linux/mm.h, include/asm-i386/page.h task_struct mm_struct vm_area_struct text mmap vm_start, vm_end mm map_count vm_next pgd... start_code, end_code vm_offset, vm_file data start_data, end_data start_brk, brk start_stack arg_start, arg_end env_start, env_end; vm_start, vm_end vm_next vm_offset, vm_file rss,... pgd_t swap or a.out

35 Hardware Context (1/3) 35 brief reminds the 80x86 architecture ALU IN Control U. OUT Registers eip, eflags eax, ebx, ecx, edx, esi, edi, cs, ds, ss, es, fs,... cr0, cr1, cr2, cr3, LDTR, TR,...

36 Hardware Context(2/3) 36 stack 쓰레드자료구조 : CPU 추상화 stack 2 heap data text movl $2, %eax pushl %eax addl %eax, %ebx EIP ESP EAX registers movl $10, %eax call func1 heap data text Address space for Task A Address space for Task B 다시 Task A 가수행되려면? 문맥교환 (Context Switch) thread structure

37 Hardware Context(3/3) 37 쓰레드자료구조 : CPU 추상화 stack stack 2 heap data EIP ESP EAX... heap data text movl $2, %eax pushl %eax addl %eax, %ebx Address space for Task A EIP ESP EAX registers EIP ESP EAX movl $10, %eax call func1 Address space for Task B text tss struct. for task A tss struct. for task B

38 task_struct & H/W context 38 쓰레드자료구조 : CPU 추상화 task_struct struct thread_struct { struct desc_struct tls_array[gdt_entry_tls_entries]; unsigned long sp0; unsigned long sp; unsigned long sysenter_cs; unsigned long ip; unsigned long cr2; unsigned long fs; unsigned long gs; struct vm86_struct user * vm86_info; unsigned long screen_bitmap; unsigned long v86flags, v86mask, saved_sp0; unsigned int saved_fs, saved_gs; unsigned long *io_bitmap_ptr; }; struct vm86_regs { long ebx; long ecx; long edx; long esi; long edi; long ebp; long eax; long eflags; long esp; };

39 Kernel Stack 39 Thread union 커널은각태스크별로 8KB메모리할당 thread_info 구조체와 kernel stack alloc_thread_struct, free_thread_struct pt_regs CPU Stack Pointer Register stack current thread_info{ *task flags(need_resched) } task_struct

40 User VS kernel mode 40 INT, syscall kernel mode 로전환 control path : kernel mode 로진입하기위한일련의명령어 struct pt_regs? 현재 P 의상태를커널스택에저장하기위해사용

41 Thread Model 비교 41 LinuxThreads vs NPTL

42 Task 계층구조확인 42

43 Task 계층구조확인 43

44 태스크연결자료구조 44 태스크연결구조 init_task task_struct task_struct task_struct next_task next_task next_task next_task prev_task prev_task prev_task prev_task... task_struct run_queue next_run prev_run 태스크가족관계 children.next next_run prev_run where is run_queue? prev_task? next_task? task_struct parent children.prev next_run prev_run younger child task_struct parent, sibling.prev parent, sibling.next sibling.next sibling.prev parent child task_struct sibling.next sibling.prev older child task_struct

45 Linux Signal 45 시그널처리자료구조 /* kernel/signal.c */ task_struct. sig blocked signal sigpending. sys_signal(sig, handler) sigset_t. signal_struct count action[_nsig] siglock 63 0 sigaction sa_handler sa_flags sa_restorer sa_mask sigset_t /* kernel/signal.c */ sys_kill(pid,sig) do_sigaction(sig, new_sa, old_sa) kill_pgrp_info(sig, info, pid) send_sig_info(sig, info, *t) sigaddset(t->signal, sig); t->sigpending = 1;

46 46 Linux Signal 시그널처리자료구조 count action[_nsig] siglock sa_handler sa_flags sa_restorer sa_mask signal sighand pending blocked. sighand_struct sigaction sigset_t sigset_t 63 0 task_struct list signal sigpending next prev info sigqueue count shared_pendin g rlim signal_struct list signal sigpending si_signo si_code siginfo next prev info sigqueue si_signo si_code siginfo next prev info sigqueue next prev info sigqueue si_signo si_code siginfo

47 Linux File 47 파일관리자료구조 : fd, inode include/linux/sched.h task_struct... fs_struct files_struct... struct fs_struct { atomic_t count; int umask; struct dentry *root, *pwd; } include/linux/sched.h struct files_struct { atomic_t count; int max_fds; struct file **fd; fd_set close_on_exec; fd_set open_fds; } include/linux/fs.h struct file { struct file *f_next, **f_pprev; struct dentry f_dentry;; struct file_operations *f_op; mode_t f_mode; loff_t f_pos; unsigned int f_count, f_flags;. } include/linux/dcache.h struct dentry { int d_count, d_flags; struct inode *d_inode; struct dentry *d_parent;. unsigned char d_iname[] } include/linux/fs.h struct inode {. }

48 Multi-CPU 를위한리눅스특징 48 스케줄링 Run queue per each CPU 일반 task : SCHED_NORMAL, SCHED_BATCH, SCHED_IDLE 100~139(-20~19) 실시간 task : SCHED_FIFO, SCHED_RR, SCHED_DEADLINE, 0~99 Load balancing T do_fork() wake_up_new_task() Runqueue T T schedule() CPU tasklist T T T T T T Runqueue T T T schedule() CPU wake_up() load_balance() Runqueue schedule() T CPU

49 Scheduling Domain & Group 49 struct sched_domain (Multi-chip level) domain struct sched_group Shared L3 cache Shared L3 cache (Multi-core level) domain (Hyper-threading level) domain

50 RT Task Scheduling 50 FIFO & RR O(1) scheduler queue[0] queue[3] queue[99] rt_prio_array.bitmap rt_prio_array.queue DEADLINE (a.k.a., EDF) deadline, runtime, period RB-tree (with deadline) Provides deterministic scheduling

51 Runqueue and Scheduler Data Structure 51 CPU CPU CFS Runqueue struct rq { unsigned int nr_running; struct load_weight load; u64 nr_switches; struct rt_rq rt; struct dl_rq dl; struct cfs_rq cfs; struct task_struct *curr; struct sched_domain *sd; unsigned long cpu_capacity; unsigned long cpu_load[ ]; }; struct cfs_rq { struct load_weight load; unsigned long nr_running; u64 exec_clock; u64 min_vruntime; struct rb_node *rb_leftmost; struct sched_entity *curr; }; #define MAX_RT_PRIO 100 struct rt_prio_array { DECLARE_BITMAP(bitmap, MAX_RT_PRIO+1); struct list_head queue[max_rt_prio]; }; FIFO & RR struct rt_rq { struct rt_prio_array active; unsigned int rt_nr_running; }; DEADLINE struct dl_rq { struct rb_root rb_root; struct rb_node *rb_leftmost; unsigned long dl_nr_running; }; struct sched_domain { struct sched_domain *parent; struct sched_domain *child; struct sched_group *groups; };

52 Test Code 52 #include <stdio.h> #include <unistd.h> #include <sched.h> int main(void) { struct sched_param param; int i, j; sched_getparam( 0, &param); } printf(" nbefore set n"); printf(" Param.priority = %d n", param.sched_priority); printf(" Sched policy = %d n", sched_getscheduler(0)); param.sched_priority = 10; sched_setscheduler(0, SCHED_FIFO, &param); sched_getparam( 0, &param); printf(" nfifo set n"); printf(" Param.priority = %d n", param.sched_priority); printf(" Sched policy = %d n", sched_getscheduler(0)); param.sched_priority = 20; sched_setscheduler(0, SCHED_RR, &param); sched_getparam( 0, &param); printf(" nrr set n"); printf(" Param.priority = %d n", param.sched_priority); printf(" Sched policy = %d n", sched_getscheduler(0)); return 0; 아래코드를화살표가가리키고있는세군데에각각넣고실행해보자. 실행도중키보드를누르면반응이있는가? 언제반응이있고, 언제없는가? for(i=0; i<100000; i++) for(j=0; j<100000; j++);

53 Normal Task Scheduling 53 CFS Completely Fair Scheduler RB-tree (with vruntime) Timer tick 에의해현재수행중인태스크의 vruntime 갱신 struct task_struct { const struct sched_class *sched_class; struct sched_entity se; }; struct sched_entity { struct load_weight load; u64 vruntime; }; update_curr(struct cfs_rq *cfs_rq) curr->vruntime += calc_delta_fair(delta_exec, curr); delta = calc_delta(delta, NICE_0_LOAD, &se->load); struct load_weight { unsigned long weight; u32 inv_weight; };

54 Normal Task Scheduling 54 CFS Completely Fair Scheduler RB-tree (with vruntime) Timer tick에의해현재수행중인태스크의 vruntime갱신 To avoid frequent context switch, there are minimum runtime and struct task_struct { const struct sched_class *sched_class; struct sched_entity se; }; struct sched_entity { struct load_weight load; u64 vruntime; }; sched_slice(struct cfs_rq *cfs_rq, struct sched_entity *se) slice = sched_period(cfs_rq->nr_running +!se->on_rq); if(nr_running > sched_nr_latency) return sysctl_sched_min_granularity * nr_running else return sysctl_sched_latency struct load_weight { unsigned long weight; u32 inv_weight; };

55 Scheduler Activation 55 How When Directly call schedule() Indirectly, mark need_resched flag Check check_preempt_tick() function for more details! Timer tick 수행중이던태스크가자신의타임슬라이스를다썼거나대기상태로전환현재태스크보다높은우선순위를가진태스크가깨어난경우스케줄링관련시스템콜호출 함수명 set_tsk_need_resched(task) clear_tsk_need_resched(task) need_resched() 목적 주어진프로세스의 need_resched 플래그를설정 주어진프로세스의 need_resched 플래그를해제 need_resched 플래그를검사. Set 이면 true, clear 이면 false 를리턴

56 Linux 스케줄링인터페이스 56 스케줄링관련시스템콜 nice() (just for backward compatibility) sys_nice() 절대값 40 넘으면 40으로맞춤 음수는관리자권한필요 capable() 함수호출해 CAP_SYS_NICE 특성이있는지확인 권한이있다면 current의 nice필드에 increment값더함 단, -20~19사이유지하게함

57 Linux 스케줄링인터페이스 57 getpriority(), setpriority() 지정한 process그룹에있는모든 process의기본우선순위에영향을미침 getpriority() 는그룹내모든process중가장낮은nice필드값뺀값반환 setpriority() 는지정그룹내모든process의기본우선순위설정 sys_getpriority(), sys_setpriority() 매개변수 which : 프로세스그룹을식별 PRIO_PROCCESS PRIO_PGRP PRIO_USER who : process 선택에사용하는 pid 나, pgrp, uid 필드의값, 0 이면 current niceval : 새로운우선순위값

58 Linux 스케줄링인터페이스 58 실시간 process 관련시스템콜 sched_getscheduler(), sched_setscheduler() 매개변수 pid 로지정한 process 에현재적용중인스케줄링정책질의 / 설정 Pid 를가지고 find_process_by_pid() 호출해, policy 값을반환 sched_getparam(), sched_setparam() pid 에해당하는 process 의스케줄링인자얻어오거나 / 설정 rt_priority 필드를 sched_param 타입지역변수로저장후 copy_to_user() 호출해복사해줌 sched_yield() Process 를보류상태로만들지않고자발적으로 CPU 반납 sched_get_priority_min(), sched_get_priority_max() policy 매개변수로지정한스케줄링정책에서사용할수있는실시간정적우선순위의최소, 최대값을반환 sched_rr_get_interval() pid 매개변수로지정한실시간 P 의 RR 타임퀀텀을사용자모드주소공간에있는구조체에기록 / 가져옴

59 Scheduling Policy and Class 59 SCHED_FIFO SCHED_RR const struct sched_class rt_sched_class = {.next = &fair_sched_class,.enqueue_task = enqueue_task_rt,.dequeue_task = dequeue_task_rt,.yield_task = yield_task_rt, }; SCHED_DEADLINE struct task_struct { const struct sched_class *sched_class; unsigned int policy; }; SCHED_NORMAL SCHED_BATCH SCHED_IDLE const struct sched_class rt_sched_class = {.next = &fair_sched_class,.enqueue_task = enqueue_task_rt,.dequeue_task = dequeue_task_rt,.yield_task = yield_task_rt, }; static const struct sched_class fair_sched_class = {.next = &idle_sched_class,.enqueue_task = enqueue_task_fair,.dequeue_task = dequeue_task_fair,.yield_task = yield_task_fair, };

60 Context Switching 60 stack Task A stack Task B heap heap User mode data text data text Kernel mode EIP ESP EAX... pt_regs stack registers pt_regs stack thread_info{ } struct task_struct { void * stack; struct thread_struct thread; }; struct task_struct { void * stack; struct thread_struct thread; }; thread_info{ }

61 switch_to() in ARM (1/16) 61 Code Window Memory Dump Window CPU register window

62 switch_to() in ARM (2/16) 62

63 switch_to() in ARM (3/16) 63

64 switch_to() in ARM (4/16) 64

65 switch_to() in ARM (5/16) 65

66 switch_to() in ARM (6/16) 66

67 switch_to() in ARM (7/16) 67

68 switch_to() in ARM (8/16) 68

69 switch_to() in ARM (9/16) 69

70 switch_to() in ARM (10/16) 70

71 switch_to() in ARM (11/16) 71

72 switch_to() in ARM (12/16) 72

73 switch_to() in ARM (13/16) 73

74 switch_to() in ARM (14/16) 74

75 switch_to() in ARM (15/16) 75

76 switch_to() in ARM (16/16) 76

Microsoft PowerPoint - LN_5_Linux_Task.ppt [호환 모드]

Microsoft PowerPoint - LN_5_Linux_Task.ppt [호환 모드] 프로젝트 1 Linux Task Management 단국대학교컴퓨터학과 2009 백승재 ibanez1383@dankook.ac.kr k k http://embedded.dankook.ac.kr/~ibanez1383 Linux 의 task 개념이해 강의목표 Task 자료구조파악 Linux 의 task 관리방법파악 Task, Process and Thread 3

More information

6주차.key

6주차.key 6, Process concept A program in execution Program code PCB (process control block) Program counter, registers, etc. Stack Heap Data section => global variable Process in memory Process state New Running

More information

슬라이드 1

슬라이드 1 프로세스 (Process) (1) Chapter #5 Process 정의 Process 구조 Process Context Process Scheduling 강의목차 Unix System Programming 2 Program( 프로그램 ) Process 정의 (1) 기계어명령어와데이터를모아놓은실행파일 C 언어등프로그램언어로작성된소스파일을컴파일링하여생성 COFF(Common

More information

리눅스커널-06

리눅스커널-06 C h a p t e r 06 CPU CPU CPU 1MB 600KB 500KB 4GB 512MB 1GB 230 231 Virtual Memory Physical Memory Virtual address Physical address 0 CPU 4GB 3GB 1GB 61 init proc1maps cat 0x08048000 0xC0000000 0x08048000

More information

Chapter #01 Subject

Chapter #01  Subject Device Driver March 24, 2004 Kim, ki-hyeon 목차 1. 인터럽트처리복습 1. 인터럽트복습 입력검출방법 인터럽트방식, 폴링 (polling) 방식 인터럽트서비스등록함수 ( 커널에등록 ) int request_irq(unsigned int irq, void(*handler)(int,void*,struct pt_regs*), unsigned

More information

좀비프로세스 2

좀비프로세스 2 Signal & Inter-Process Communication Department of Computer Engineering Kyung Hee University. Choong Seon Hong 1 좀비프로세스 2 좀비프로세스 (zombie process) 좀비프로세스란프로세스종료후메모리상에서사라지지않는프로세스 좀비프로세스의생성이유. 자식프로세스는부모프로세스에게실행결과에대한값을반환해야한다.

More information

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

3. 다음장에나오는 sigprocmask 함수의설명을참고하여다음프로그램의출력물과그출력물이화면이표시되는시점을예측하세요. ( 힌트 : 각줄이표시되는시점은다음 4 가지중하나. (1) 프로그램수행직후, (2) kill 명령실행직후, (3) 15 #include <signal. 학번 : 이름 : 1. 다음가정하에서아래프로그램의출력물을예측하세요. 가정 : 부모프로세스의 process id=20100, 자식프로세스의 process id=20101. int glob = 31; /* external variable in initialized data */ char buf[] = "a write to stdout\n"; int main(void)

More information

Chap04(Signals and Sessions).PDF

Chap04(Signals and Sessions).PDF 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

More information

hlogin2

hlogin2 0x02. Stack Corruption off-limit Kernel Stack libc Heap BSS Data Code off-limit Kernel Kernel : OS Stack libc Heap BSS Data Code Stack : libc : Heap : BSS, Data : bss Code : off-limit Kernel Kernel : OS

More information

Deok9_Exploit Technique

Deok9_Exploit Technique Exploit Technique CodeEngn Co-Administrator!!! and Team Sur3x5F Member Nick : Deok9 E-mail : DDeok9@gmail.com HomePage : http://deok9.sur3x5f.org Twitter :@DDeok9 > 1. Shell Code 2. Security

More information

untitled

untitled Embedded System Lab. II Embedded System Lab. II 2 RTOS Hard Real-Time vs Soft Real-Time RTOS Real-Time, Real-Time RTOS General purpose system OS H/W RTOS H/W task Hard Real-Time Real-Time System, Hard

More information

untitled

untitled Step Motor Device Driver Embedded System Lab. II Step Motor Step Motor Step Motor source Embedded System Lab. II 2 open loop, : : Pulse, 1 Pulse,, -, 1 +5%, step Step Motor (2),, Embedded System Lab. II

More information

강의10

강의10 Computer Programming gdb and awk 12 th Lecture 김현철컴퓨터공학부서울대학교 순서 C Compiler and Linker 보충 Static vs Shared Libraries ( 계속 ) gdb awk Q&A Shared vs Static Libraries ( 계속 ) Advantage of Using Libraries Reduced

More information

임베디드시스템설계강의자료 6 system call 2/2 (2014 년도 1 학기 ) 김영진 아주대학교전자공학과

임베디드시스템설계강의자료 6 system call 2/2 (2014 년도 1 학기 ) 김영진 아주대학교전자공학과 임베디드시스템설계강의자료 6 system call 2/2 (2014 년도 1 학기 ) 김영진 아주대학교전자공학과 System call table and linkage v Ref. http://www.ibm.com/developerworks/linux/library/l-system-calls/ - 2 - Young-Jin Kim SYSCALL_DEFINE 함수

More information

Microsoft PowerPoint - Lecture_Note_7.ppt [Compatibility Mode]

Microsoft PowerPoint - Lecture_Note_7.ppt [Compatibility Mode] Unix Process Department of Computer Engineering Kyung Hee University. Choong Seon Hong 1 유닉스기반다중서버구현방법 클라이언트들이동시에접속할수있는서버 서비스를동시에처리할수있는서버프로세스생성을통한멀티태스킹 (Multitasking) 서버의구현 select 함수에의한멀티플렉싱 (Multiplexing)

More information

/chroot/lib/ /chroot/etc/

/chroot/lib/ /chroot/etc/ 구축 환경 VirtualBox - Fedora 15 (kernel : 2.6.40.4-5.fc15.i686.PAE) 작동 원리 chroot유저 ssh 접속 -> 접속유저의 홈디렉토리 밑.ssh의 rc 파일 실행 -> daemonstart실행 -> daemon 작동 -> 접속 유저만의 Jail 디렉토리 생성 -> 접속 유저의.bashrc 의 chroot 명령어

More information

ABC 11장

ABC 11장 12 장고급응용 0 수행중인프로그램 프로세스 모든프로세스는유일한프로세스식별번호 (PID) 를가짐 유닉스에서는 ps 명령을사용하여프로세스목록을볼수있음 12-1 프로세스 $ ps -aux USER PID %CPU %MEM SZ RSS TT STAT START TIME COMMAND blufox 17725 34.0 1.6 146 105 i2 R 15:13 0:00

More information

<4D F736F F F696E74202D FC7C1B7CEBCBCBDBA20BBFDBCBAB0FA20BDC7C7E0205BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D FC7C1B7CEBCBCBDBA20BBFDBCBAB0FA20BDC7C7E0205BC8A3C8AF20B8F0B5E55D> 학습목표 프로세스를생성하는방법을이해한다. 프로세스를종료하는방법을이해한다. exec함수군으로새로운프로그램을실행하는방법을이해한다. 프로세스를동기화하는방법을이해한다. 프로세스생성과실행 IT CookBook, 유닉스시스템프로그래밍 2/24 목차 프로세스생성 프로세스종료함수 exec 함수군활용 exec 함수군과 fork 함수 프로세스동기화 프로세스생성 [1] 프로그램실행

More information

2009년 상반기 사업계획

2009년 상반기 사업계획 프로세스생성과실행 IT CookBook, 유닉스시스템프로그래밍 학습목표 프로세스를생성하는방법을이해한다. 프로세스를종료하는방법을이해한다. exec함수군으로새로운프로그램을실행하는방법을이해한다. 프로세스를동기화하는방법을이해한다. 2/24 목차 프로세스생성 프로세스종료함수 exec 함수군활용 exec 함수군과 fork 함수 프로세스동기화 3/24 프로세스생성 [1]

More information

10.

10. 10. 10.1 10.2 Library Routine: void perror (char* str) perror( ) str Error 0 10.3 10.3 int fd; /* */ fd = open (filename, ) /*, */ if (fd = = -1) { /* */ } fcnt1 (fd, ); /* */ read (fd, ); /* */ write

More information

임베디드시스템설계강의자료 6 system call 1/2 (2014 년도 1 학기 ) 김영진 아주대학교전자공학과

임베디드시스템설계강의자료 6 system call 1/2 (2014 년도 1 학기 ) 김영진 아주대학교전자공학과 임베디드시스템설계강의자료 6 system call 1/2 (2014 년도 1 학기 ) 김영진 아주대학교전자공학과 시스템호출개요 리눅스에서는사용자공간과커널공간을구분 사용자프로그램은사용자모드, 운영체제는커널모드에서수행 커널공간에대한접근은커널 ( 특권, priviledged) 모드에서가능 컴퓨팅자원 (CPU, memory, I/O 등 ) 을안전하게보호 커널수행을안전하게유지

More information

KEY 디바이스 드라이버

KEY 디바이스 드라이버 KEY 디바이스드라이버 임베디드시스템소프트웨어 I (http://et.smu.ac.kr et.smu.ac.kr) 차례 GPIO 및 Control Registers KEY 하드웨어구성 KEY Driver 프로그램 key-driver.c 시험응용프로그램 key-app.c KEY 디바이스드라이버 11-2 GPIO(General-Purpose Purpose I/O)

More information

Figure 5.01

Figure 5.01 Chapter 4: Threads Yoon-Joong Kim Hanbat National University, Computer Engineering Department Chapter 4: Multithreaded Programming Overview Multithreading Models Thread Libraries Threading Issues Operating

More information

교육지원 IT시스템 선진화

교육지원 IT시스템 선진화 Module 16: ioctl 을활용한 LED 제어디바이스드라이버 ESP30076 임베디드시스템프로그래밍 (Embedded System Programming) 조윤석 전산전자공학부 주차별목표 ioctl() 을활용법배우기 커널타이머와 ioctl 을활용하여 LED 제어용디바이스드라이브작성하기 2 IOCTL 을이용한드라이버제어 ioctl() 함수활용 어떤경우에는읽는용도로만쓰고,

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Network Programming Jo, Heeseung Network 실습 네트워크프로그래밍 멀리떨어져있는호스트들이서로데이터를주고받을수있도록프로그램을구현하는것 파일과는달리데이터를주고받을대상이멀리떨어져있기때문에소프트웨어차원에서호스트들간에연결을해주는장치가필요 이러한기능을해주는장치로소켓이라는인터페이스를많이사용 소켓프로그래밍이란용어와네트워크프로그래밍이랑용어가같은의미로사용

More information

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

1장.  유닉스 시스템 프로그래밍 개요 Unix 프로그래밍및실습 7 장. 시그널 - 과제보충 응용과제 1 부모프로세스는반복해서메뉴를출력하고사용자로부터주문을받아자식프로세스에게주문내용을알린다. (SIGUSR1) ( 일단주문을받으면음식이완료되기전까지 SIGUSR1 을제외한다른시그널은모두무시 ) timer 자식프로세스는주문을받으면조리를시작한다. ( 일단조리를시작하면음식이완성되기전까지 SIGALARM 을제외한다른시그널은모두무시

More information

커알못의 커널 탐방기 이 세상의 모든 커알못을 위해서

커알못의 커널 탐방기 이 세상의 모든 커알못을 위해서 커알못의 커널 탐방기 2015.12 이 세상의 모든 커알못을 위해서 개정 이력 버전/릴리스 0.1 작성일자 2015년 11월 30일 개요 최초 작성 0.2 2015년 12월 1일 보고서 구성 순서 변경 0.3 2015년 12월 3일 오탈자 수정 및 글자 교정 1.0 2015년 12월 7일 내용 추가 1.1 2015년 12월 10일 POC 코드 삽입 및 코드

More information

Chap06(Interprocess Communication).PDF

Chap06(Interprocess Communication).PDF Interprocess Communication 2002 2 Hyun-Ju Park Introduction (interprocess communication; IPC) IPC data transfer sharing data event notification resource sharing process control Interprocess Communication

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 7-Segment Device Control - Device driver Jo, Heeseung HBE-SM5-S4210 의 M3 Module 에는 6 자리를가지는 7-Segment 모듈이아래그림처럼실장 6 Digit 7-Segment 2 6-Digit 7-Segment LED controller 16비트로구성된 2개의레지스터에의해제어 SEG_Sel_Reg(Segment

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 7-Segment Device Control - Device driver Jo, Heeseung HBE-SM5-S4210 의 M3 Module 에는 6 자리를가지는 7-Segment 모듈이아래그림처럼실장 6 Digit 7-Segment 2 6-Digit 7-Segment LED Controller 16비트로구성된 2개의레지스터에의해제어 SEG_Sel_Reg(Segment

More information

chap7.key

chap7.key 1 7 C 2 7.1 C (System Calls) Unix UNIX man Section 2 C. C (Library Functions) C 1975 Dennis Ritchie ANSI C Standard Library 3 (system call). 4 C?... 5 C (text file), C. (binary file). 6 C 1. : fopen( )

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 7-SEGMENT DEVICE CONTROL - DEVICE DRIVER Jo, Heeseung 디바이스드라이버구현 : 7-SEGMENT HBE-SM5-S4210 의 M3 Module 에는 6 자리를가지는 7-Segment 모듈이아래그림처럼실장 6 Digit 7-Segment 2 디바이스드라이버구현 : 7-SEGMENT 6-Digit 7-Segment LED

More information

Sena Technologies, Inc. HelloDevice Super 1.1.0

Sena Technologies, Inc. HelloDevice Super 1.1.0 HelloDevice Super 110 Copyright 1998-2005, All rights reserved HelloDevice 210 ()137-130 Tel: (02) 573-5422 Fax: (02) 573-7710 E-Mail: support@senacom Website: http://wwwsenacom Revision history Revision

More information

슬라이드 1

슬라이드 1 / 유닉스시스템개요 / 파일 / 프로세스 01 File Descriptor file file descriptor file type unix 에서의파일은단지바이트들의나열임 operating system 은파일에어떤포맷도부과하지않음 파일의내용은바이트단위로주소를줄수있음 file descriptor 는 0 이나양수임 file 은 open 이나 creat 로 file

More information

<4D F736F F F696E74202D205BBAB0C3B75D20B8AEB4AABDBA20B5F0B9D9C0CCBDBA20B5E5B6F3C0CCB9F620B8F0B5A82E >

<4D F736F F F696E74202D205BBAB0C3B75D20B8AEB4AABDBA20B5F0B9D9C0CCBDBA20B5E5B6F3C0CCB9F620B8F0B5A82E > 안드로이드환경에서의 리눅스디바이스드라이버 문자디바이스드라이버설명 Table of contents 디바이스드라이버구조 시스템구조 모듈의기본골격 드라이버 IO 제어 안드로이드환경에서의 한백전자교육사업부 리눅스디바이스드라이버 시스템구조 쉘 응용프로그램 표준라이브러리 시스템콜 가상파일시스템 (VFS) 버퍼캐시 네트워크시스템 문자디바이스드라이버 블럭디바이스드라이버 네트워크디바이스드라이버

More information

hlogin7

hlogin7 0x07. Return Oriented Programming ROP? , (DEP, ASLR). ROP (Return Oriented Programming) (excutable memory) rop. plt, got got overwrite RTL RTL Chain DEP, ASLR gadget Basic knowledge plt, got call function

More information

Microsoft PowerPoint APUE(Intro).ppt

Microsoft PowerPoint APUE(Intro).ppt 컴퓨터특강 () [Ch. 1 & Ch. 2] 2006 년봄학기 문양세강원대학교컴퓨터과학과 APUE 강의목적 UNIX 시스템프로그래밍 file, process, signal, network programming UNIX 시스템의체계적이해 시스템프로그래밍능력향상 Page 2 1 APUE 강의동기 UNIX 는인기있는운영체제 서버시스템 ( 웹서버, 데이터베이스서버

More information

10주차.key

10주차.key 10, Process synchronization (concurrently) ( ) => critical section ( ) / =>, A, B / Race condition int counter; Process A { counter++; } Process B { counter ;.. } counter++ register1 = counter register1

More information

chap 5: Trees

chap 5: Trees 5. Threaded Binary Tree 기본개념 n 개의노드를갖는이진트리에는 2n 개의링크가존재 2n 개의링크중에 n + 1 개의링크값은 null Null 링크를다른노드에대한포인터로대체 Threads Thread 의이용 ptr left_child = NULL 일경우, ptr left_child 를 ptr 의 inorder predecessor 를가리키도록변경

More information

K&R2 Reference Manual 번역본

K&R2 Reference Manual 번역본 typewriter structunion struct union if-else if if else if if else if if if if else else ; auto register static extern typedef void char short int long float double signed unsigned const volatile { } struct

More information

Microsoft PowerPoint - 05_프로세스(my).ppt [호환 모드]

Microsoft PowerPoint - 05_프로세스(my).ppt [호환 모드] 5 장프로세스 프로세스와프로세스디스크립터의이해 task_struct 구조체 프로세스생성과소멸 프로세스상태와전이 스케줄링 시그널 한빛미디어 ( 주 ) Section 01 프로세스와프로세스디스크립터의이해 Section 01 프로세스란? 실행중인프로그램 프로세스 = 태스크 (task) 자신에게포함된기계어명령을종료할때까지실행하는동적인존재 살아있는동안많은자원을사용 자원

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 KeyPad Device Control - Device driver Jo, Heeseung HBE-SM5-S4210 에는 16 개의 Tack Switch 를사용하여 4 행 4 열의 Keypad 가장착 4x4 Keypad 2 KeyPad 를제어하기위하여 FPGA 내부에 KeyPad controller 가구현 KeyPad controller 16bit 로구성된

More information

INTRO Basic architecture of modern computers Basic and most used assembly instructions on x86 Installing an assembly compiler and RE tools Practice co

INTRO Basic architecture of modern computers Basic and most used assembly instructions on x86 Installing an assembly compiler and RE tools Practice co Basic reverse engineering on x86 This is for those who want to learn about basic reverse engineering on x86 (Feel free to use this, email me if you need a keynote version.) v0.1 SeungJin Beist Lee beist@grayhash.com

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Text-LCD Device Control - Device driver Jo, Heeseung M3 모듈에장착되어있는 Tedxt LCD 장치를제어하는 App 을개발 TextLCD 는영문자와숫자일본어, 특수문자를표현하는데사용되는디바이스 HBE-SM5-S4210 의 TextLCD 는 16 문자 *2 라인을 Display 할수있으며, 이 TextLCD 를제어하기위하여

More information

No Slide Title

No Slide Title Copyright, 2017 Multimedia Lab., UOS 시스템프로그래밍 (Assembly Code and Calling Convention) Seong Jong Choi chois@uos.ac.kr Multimedia Lab. Dept. of Electrical and Computer Eng. University of Seoul Seoul, Korea

More information

Embeddedsystem(8).PDF

Embeddedsystem(8).PDF insmod init_module() register_blkdev() blk_init_queue() blk_dev[] request() default queue blkdevs[] block_device_ops rmmod cleanup_module() unregister_blkdev() blk_cleanup_queue() static struct { const

More information

제1장 Unix란 무엇인가?

제1장  Unix란 무엇인가? 1 12 장파이프 2 12.1 파이프 파이프원리 $ who sort 파이프 3 물을보내는수도파이프와비슷 한프로세스는쓰기용파일디스크립터를이용하여파이프에데이터를보내고 ( 쓰고 ) 다른프로세스는읽기용파일디스크립터를이용하여그파이프에서데이터를받는다 ( 읽는다 ). 한방향 (one way) 통신 파이프생성 파이프는두개의파일디스크립터를갖는다. 하나는쓰기용이고다른하나는읽기용이다.

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Reasons for Poor Performance Programs 60% Design 20% System 2.5% Database 17.5% Source: ORACLE Performance Tuning 1 SMS TOOL DBA Monitoring TOOL Administration TOOL Performance Insight Backup SQL TUNING

More information

슬라이드 1

슬라이드 1 -Part3- 제 4 장동적메모리할당과가변인 자 학습목차 4.1 동적메모리할당 4.1 동적메모리할당 4.1 동적메모리할당 배울내용 1 프로세스의메모리공간 2 동적메모리할당의필요성 4.1 동적메모리할당 (1/6) 프로세스의메모리구조 코드영역 : 프로그램실행코드, 함수들이저장되는영역 스택영역 : 매개변수, 지역변수, 중괄호 ( 블록 ) 내부에정의된변수들이저장되는영역

More information

Microsoft PowerPoint - chap6 [호환 모드]

Microsoft PowerPoint - chap6 [호환 모드] 제 6 장프로세스 (Process) 숙대창병모 1 내용 프로세스시작 / 종료 명령중인수 / 환경변수 메모리배치 / 할당 비지역점프 숙대창병모 2 프로세스시작 / 종료 숙대창병모 3 Process Start Kernel exec system call user process Cstart-up routine call return int main(int argc,

More information

<443A5C4C C4B48555C B3E25C32C7D0B1E25CBCB3B0E8C7C1B7CEC1A7C6AE425CBED0C3E0C7C1B7CEB1D7B7A55C D616E2E637070>

<443A5C4C C4B48555C B3E25C32C7D0B1E25CBCB3B0E8C7C1B7CEC1A7C6AE425CBED0C3E0C7C1B7CEB1D7B7A55C D616E2E637070> #include "stdafx.h" #include "Huffman.h" 1 /* 비트의부분을뽑아내는함수 */ unsigned HF::bits(unsigned x, int k, int j) return (x >> k) & ~(~0

More information

본 강의에 들어가기 전

본 강의에 들어가기 전 유닉스프로그래밍및실습 9 장. 시그널 1. 시그널개념 시그널생명주기 시그널이발생한다. 커널이해당시그널을쌓아둔다.( 동일한시그널이오는경우하나만 ) 가능한시점에서커널이적절하게처리한다 커널의처리방법 시그널무시 아무런동작을하지않는다 절대무시할수없는시그널 SIGKILL SIGSTOP 시그널을붙잡아처리 현재코드경로를따라가는실행을중단하고, 시그널마다등록된함수로점프 기본동작

More information

제9장 프로세스 제어

제9장 프로세스 제어 제 9 장프로세스제어 리눅스시스템프로그래밍 청주대학교전자공학과 한철수 제 9 장 목차 프로세스생성 프로그램실행 입출력재지정 프로세스그룹 시스템부팅 2 9.1 절 프로세스생성 fork() 시스템호출 새로운프로그램을실행하기위해서는먼저새로운프로세스를생성해야하는데, fork() 시스템호출이새로운프로세스를생성하는유일한방법임. 함수프로토타입 pid_t fork(void);

More information

Microsoft PowerPoint - 09-Pipe

Microsoft PowerPoint - 09-Pipe 9. 파이프 상명대학교소프트웨어학부 파이프 시그널은이상한사건이나오류를처리하는데는이용하지만, 한프로세스로부터다른프로세스로대량의정보를전송하는데는부적합하다. 파이프 한프로세스를다른관련된프로세스에연결시켜주는단방향의통신채널 2 pipe() Usage #include int pipe(int filedes[2]); 3 < ex_1.c > #include

More information

Microsoft Word - FunctionCall

Microsoft Word - FunctionCall Function all Mechanism /* Simple Program */ #define get_int() IN KEYOARD #define put_int(val) LD A val \ OUT MONITOR int add_two(int a, int b) { int tmp; tmp = a+b; return tmp; } local auto variable stack

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Web server porting 2 Jo, Heeseung Web 을이용한 LED 제어 Web 을이용한 LED 제어프로그램 web 에서데이터를전송받아타겟보드의 LED 를조작하는프로그램을작성하기위해다음과같은소스파일을생성 2 Web 을이용한 LED 제어 LED 제어프로그램작성 8bitled.html 파일을작성 root@ubuntu:/working/web# vi

More information

Microsoft PowerPoint - a10.ppt [호환 모드]

Microsoft PowerPoint - a10.ppt [호환 모드] Structure Chapter 10: Structures t and Macros Structure 관련된변수들의그룹으로이루어진자료구조 template, pattern field structure를구성하는변수 (cf) C언어의 struct 프로그램의 structure 접근 entire structure 또는 individual fields Structure는

More information

Microsoft PowerPoint - o8.pptx

Microsoft PowerPoint - o8.pptx 메모리보호 (Memory Protection) 메모리보호를위해 page table entry에 protection bit와 valid bit 추가 Protection bits read-write / read-only / executable-only 정의 page 단위의 memory protection 제공 Valid bit (or valid-invalid bit)

More information

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

(Asynchronous Mode) ( 1, 5~8, 1~2) & (Parity) 1 ; * S erial Port (BIOS INT 14H) - 1 - (Asynchronous Mode) - - - ( 1, 5~8, 1~2) & (Parity) 1 ; * S erial Port (BIOS INT 14H) - 1 - UART (Univ ers al As y nchronous Receiver / T rans mitter) 8250A 8250A { COM1(3F8H). - Line Control Register

More information

Microsoft PowerPoint - ch09_파이프 [호환 모드]

Microsoft PowerPoint - ch09_파이프 [호환 모드] 학습목표 파이프를이용한 IPC 기법을이해한다. 이름없는파이프를이용해통신프로그램을작성할수있다. 이름있는파이프를이용해통신프로그램을작성할수있다. 파이프 IT CookBook, 유닉스시스템프로그래밍 2/20 목차 파이프의개념 이름없는파이프만들기 복잡한파이프생성 양방향파이프활용 이름있는파이프만들기 파이프의개념 파이프 두프로세스간에통신할수있도록해주는특수파일 그냥파이프라고하면일반적으로이름없는파이프를의미

More information

2009년 상반기 사업계획

2009년 상반기 사업계획 파이프 IT CookBook, 유닉스시스템프로그래밍 학습목표 파이프를이용한 IPC 기법을이해한다. 이름없는파이프를이용해통신프로그램을작성할수있다. 이름있는파이프를이용해통신프로그램을작성할수있다. 2/20 목차 파이프의개념 이름없는파이프만들기 복잡한파이프생성 양방향파이프활용 이름있는파이프만들기 3/20 파이프의개념 파이프 두프로세스간에통신할수있도록해주는특수파일 그냥파이프라고하면일반적으로이름없는파이프를의미

More information

Microsoft PowerPoint - LN_7_Linux_MM.ppt [호환 모드]

Microsoft PowerPoint - LN_7_Linux_MM.ppt [호환 모드] 프로젝트 1 Memory Management 단국대학교컴퓨터학과 29 백승재 ibanez1383@dankook.ac.kr k k http://embedded.dankook.ac.kr/~ibanez1383 강의목표 리눅스의물리메모리관리기법이해 할당 / 해제기법 리눅스의가상메모리관리기법이해 할당 / 해제기법 리눅스의물리메모리와가상메모리연결 / 혹은변환기법이해 가상메모리개념

More information

System Programming Lab

System Programming Lab System Programming Lab Week 4: Shell Schedule for your own shell 1 st shell 기본기능 fork / exec Background Processing/ Sequential Execution ls, find, grep 2 nd Environment variables/ Shell variables built-in

More information

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

3. 다음장에나오는 sigprocmask 함수의설명을참고하여다음프로그램의출력물과그출력물이화면이표시되는시점을예측하세요. ( 힌트 : 각줄이표시되는시점은다음 6 가지중하나. (1) 프로그램수행직후, (2) 5 초후 (3) 10 초후 (4) 15 #include <signa 학번 : 이름 : 1. 다음가정하에서아래프로그램의출력물을예측하세요. 가정 : 부모프로세스의 process id=10100, 자식프로세스의 process id=10101. char buf[] = "a write to stdout\n"; int var; /* automatic variable on the stack */ pid_t pid; int glob = 31;

More information

Microsoft PowerPoint - lab14.pptx

Microsoft PowerPoint - lab14.pptx Mobile & Embedded System Lab. Dept. of Computer Engineering Kyung Hee Univ. Keypad Device Control in Embedded Linux HBE-SM5-S4210 에는 16 개의 Tack Switch 를사용하여 4 행 4 열의 Keypad 가장착되어있다. 2 Keypad Device Driver

More information

untitled

untitled (shared) (integrated) (stored) (operational) (data) : (DBMS) :, (database) :DBMS File & Database - : - : ( : ) - : - : - :, - DB - - -DBMScatalog meta-data -DBMS -DBMS - -DBMS concurrency control E-R,

More information

Microsoft PowerPoint - 10_Signal

Microsoft PowerPoint - 10_Signal Operating System Laboratory 시그널 - IPC - 시그널의종류 - 시그널구현함수 IPC 프로세스간통신 (Inter-Process Communication) 실행중인프로세스간에데이터를주고받는기법 IPC 에는매우많은방법이있다! File Pipe/Named pipe Socket Shared memory Message passing Remote

More information

슬라이드 1

슬라이드 1 / 임베디드시스템개요 / 임베디드운영체제 / 디바이스드라이버 01 Linux System Architecture Application Area Application System Call Interface BSD Socket Virtual File System INET(AF_INET) Kernel Area Buffer Cache Network Subsystem

More information

PCServerMgmt7

PCServerMgmt7 Web Windows NT/2000 Server DP&NM Lab 1 Contents 2 Windows NT Service Provider Management Application Web UI 3 . PC,, Client/Server Network 4 (1),,, PC Mainframe PC Backbone Server TCP/IP DCS PLC Network

More information

UI TASK & KEY EVENT

UI TASK & KEY EVENT KEY EVENT & STATE 구현 2007. 1. 25 PLATFORM TEAM 정용학 차례 Key Event HS TASK UI TASK LONG KEY STATE 구현 소스코드및실행화면 질의응답및토의 2 KEY EVENT - HS TASK hs_task keypad_scan_keypad hs_init keypad_pass_key_code keypad_init

More information

Chapter 4. LISTS

Chapter 4. LISTS 6. 동치관계 (Equivalence Relations) 동치관계 reflexive, symmetric, transitive 성질을만족 "equal to"(=) 관계는동치관계임. x = x x = y 이면 y = x x = y 이고 y = z 이면 x = z 동치관계를이용하여집합 S 를 동치클래스 로분할 동일한클래스내의원소 x, y 에대해서는 x y 관계성립

More information

본 강의에 들어가기 전

본 강의에 들어가기 전 C 기초특강 종합과제 과제내용 구조체를이용하여교과목이름과코드를파일로부터입력받아관리 구조체를이용하여학생들의이름, 학번과이수한교과목의코드와점수를파일로부터입력 학생개인별총점, 평균계산 교과목별이수학생수, 총점및평균을계산 결과를파일에저장하는프로그램을작성 2 Makefile OBJS = score_main.o score_input.o score_calc.o score_print.o

More information

02.Create a shellcode that executes "/bin/sh" Excuse the ads! We need some help to keep our site up. List Create a shellcode that executes "/bin/sh" C

02.Create a shellcode that executes /bin/sh Excuse the ads! We need some help to keep our site up. List Create a shellcode that executes /bin/sh C 02.Create a shellcode that executes "/bin/sh" Excuse the ads! We need some help to keep our site up. List Create a shellcode that executes "/bin/sh" C language Assembly code Change permissions(seteuid())

More information

ETL_project_best_practice1.ppt

ETL_project_best_practice1.ppt ETL ETL Data,., Data Warehouse DataData Warehouse ETL tool/system: ETL, ETL Process Data Warehouse Platform Database, Access Method Data Source Data Operational Data Near Real-Time Data Modeling Refresh/Replication

More information

제1장 Unix란 무엇인가?

제1장  Unix란 무엇인가? 4 장파일 컴퓨터과학과박환수 1 2 4.1 시스템호출 컴퓨터시스템구조 유닉스커널 (kernel) 하드웨어를운영관리하여다음과같은서비스를제공 파일관리 (File management) 프로세스관리 (Process management) 메모리관리 (Memory management) 통신관리 (Communication management) 주변장치관리 (Device

More information

TEL: 042-863-8301~3 FAX: 042-863-8304 5 6 6 6 6 7 7 8 8 9 9 10 10 10 10 10 11 12 12 12 13 14 15 14 16 17 17 18 1 8 9 15 1 8 9 15 9. REMOTE 9.1 Remote Mode 1) CH Remote Flow Set 0 2) GMate2000A

More information

금오공대 컴퓨터공학전공 강의자료

금오공대 컴퓨터공학전공 강의자료 C 프로그래밍프로젝트 Chap 14. 포인터와함수에대한이해 2013.10.09. 오병우 컴퓨터공학과 14-1 함수의인자로배열전달 기본적인인자의전달방식 값의복사에의한전달 val 10 a 10 11 Department of Computer Engineering 2 14-1 함수의인자로배열전달 배열의함수인자전달방식 배열이름 ( 배열주소, 포인터 ) 에의한전달 #include

More information

Microsoft PowerPoint - 11_Thread

Microsoft PowerPoint - 11_Thread Linux 쓰레드 - 기본 - Pthread - 생성과소멸 - 동기화 - 공유변수 - 상호배제 기본? 경량프로세스 (lightweight process: LWP) 일반프로세스는생성시자신만의메모리영역을할당받는다 PCB, code, static, heap, stack 등 : PCB 와스택만별도로할당받고나머지는부모프로세스와공유 생성과전환 (context switch)

More information

IDA 5.x Manual 07.02.hwp

IDA 5.x Manual 07.02.hwp IDA 5.x Manual - Manual 01 - 영리를 목적으로 한 곳에서 배포금지 Last Update 2007. 02 이강석 / certlab@gmail.com 어셈블리어 개발자 그룹 :: 어셈러브 http://www.asmlove.co.kr - 1 - IDA Pro 는 Disassembler 프로그램입니다. 기계어로 되어있는 실행파일을 어셈블리언어

More information

Microsoft PowerPoint - Chapter_09.pptx

Microsoft PowerPoint - Chapter_09.pptx 프로그래밍 1 1 Chapter 9. Structures May, 2016 Dept. of software Dankook University http://embedded.dankook.ac.kr/~baeksj 구조체의개념 (1/4) 2 (0,0) 구조체 : 다양한종류의데이터로구성된사용자정의데이터타입 복잡한자료를다루는것을편하게해줌 예 #1: 정수로이루어진 x,

More information

Here is a "PLDWorld.com"... // EXCALIBUR... // Additional Resources // µc/os-ii... Page 1 of 23 Additional Resources: µc/os-ii Author: Source: HiTEL D

Here is a PLDWorld.com... // EXCALIBUR... // Additional Resources // µc/os-ii... Page 1 of 23 Additional Resources: µc/os-ii Author: Source: HiTEL D Page 1 of 23 Additional Resources: µc/os-ii Author: Source: HiTEL Digital Sig Date: 2004929 µ (1) uc/os-ii RTOS uc/os-ii EP7209 uc/os-ii, EP7209 EP7209,, CPU ARM720 Core CPU ARM7 CPU wwwnanowitcom10 '

More information

11장 포인터

11장 포인터 Dynamic Memory and Linked List 1 동적할당메모리의개념 프로그램이메모리를할당받는방법 정적 (static) 동적 (dynamic) 정적메모리할당 프로그램이시작되기전에미리정해진크기의메모리를할당받는것 메모리의크기는프로그램이시작하기전에결정 int i, j; int buffer[80]; char name[] = data structure"; 처음에결정된크기보다더큰입력이들어온다면처리하지못함

More information

<4D F736F F F696E74202D BDC3B1D7B3CEB0FA20BDC3B1D7B3CE20C3B3B8AE2E707074>

<4D F736F F F696E74202D BDC3B1D7B3CEB0FA20BDC3B1D7B3CE20C3B3B8AE2E707074> 10 장시그널과시그널처리 시그널과시그널처리 - sigemptyset, sigfillset - sigaddset, sigdelset, sigismember - sigaction - sigprocmask - kill, raise - alarm - pause 1 1. 서론 시그널의종류 이름설명 DA SIGABRT abort() 를호출할때발생 SIGALRM 설정된알람시간이경과한겨우발생

More information

1217 WebTrafMon II

1217 WebTrafMon II (1/28) (2/28) (10 Mbps ) Video, Audio. (3/28) 10 ~ 15 ( : telnet, ftp ),, (4/28) UDP/TCP (5/28) centralized environment packet header information analysis network traffic data, capture presentation network

More information

02 C h a p t e r Java

02 C h a p t e r Java 02 C h a p t e r Java Bioinformatics in J a va,, 2 1,,,, C++, Python, (Java),,, (http://wwwbiojavaorg),, 13, 3D GUI,,, (Java programming language) (Sun Microsystems) 1995 1990 (green project) TV 22 CHAPTER

More information

vi 사용법

vi 사용법 유닉스프로그래밍및실습 gdb 사용법 fprintf 이용 단순디버깅 확인하고자하는코드부분에 fprintf(stderr, ) 를이용하여그지점까지도달했는지여부와관심있는변수의값을확인 여러유형의단순한문제를확인할수있음 그러나자세히살펴보기위해서는디버깅툴필요 int main(void) { int count; long large_no; double real_no; init_vars();

More information

歯9장.PDF

歯9장.PDF 9 Hello!! C printf() scanf() getchar() putchar() gets() puts() fopen() fclose() fprintf() fscant() fgetc() fputs() fgets() gputs() fread() fwrite() fseek() ftell() I/O 2 (stream) C (text stream) : `/n'

More information

Microsoft PowerPoint - ch10 - 이진트리, AVL 트리, 트리 응용 pm0600

Microsoft PowerPoint - ch10 - 이진트리, AVL 트리, 트리 응용 pm0600 균형이진탐색트리 -VL Tree delson, Velskii, Landis에의해 1962년에제안됨 VL trees are balanced n VL Tree is a binary search tree such that for every internal node v of T, the heights of the children of v can differ by at

More information

61 62 63 64 234 235 p r i n t f ( % 5 d :, i+1); g e t s ( s t u d e n t _ n a m e [ i ] ) ; if (student_name[i][0] == \ 0 ) i = MAX; p r i n t f (\ n :\ n ); 6 1 for (i = 0; student_name[i][0]!= \ 0&&

More information

DE1-SoC Board

DE1-SoC Board 실습 1 개발환경 DE1-SoC Board Design Tools - Installation Download & Install Quartus Prime Lite Edition http://www.altera.com/ Quartus Prime (includes Nios II EDS) Nios II Embedded Design Suite (EDS) is automatically

More information

Abstract View of System Components

Abstract View of System Components Operating System 10 주차 - IPC(InterProcess Communication) - Real-Time Computing and Communications Lab. Hanyang University jtlim@rtcc.hanyang.ac.kr yschoi@rtcc.hanyang.ac.kr shpark@rtcc.hanyang.ac.kr Contents

More information

<4D F736F F F696E74202D C465F4B6F F6E662DB8AEB4AABDBABFA1BCADC0C7BDC7BDC3B0A3C1F6BFF8>

<4D F736F F F696E74202D C465F4B6F F6E662DB8AEB4AABDBABFA1BCADC0C7BDC7BDC3B0A3C1F6BFF8> Korea Tech Conference 2005 년 5 월 14 일, 서울 2005 년 5 월 14 일 CE Linux Forum Korea Tech Conference 1 리눅스에서의실시간지원 정영준 / 임용관 2005 년 5 월 14 일 CE Linux Forum Korea Tech Conference 2 1. 개요 2. 스케줄러 목차 I. 고정스케줄링시간지원

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 DEVELOPMENT ENVIRONMENT 2 MAKE Jo, Heeseung MAKE Definition make is utility to maintain groups of programs Object If some file is modified, make detects it and update files related with modified one 2

More information

<4D F736F F F696E74202D20B8AEB4AABDBA20BFC0B7F920C3B3B8AEC7CFB1E22E BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D20B8AEB4AABDBA20BFC0B7F920C3B3B8AEC7CFB1E22E BC8A3C8AF20B8F0B5E55D> 리눅스 오류처리하기 2007. 11. 28 안효창 라이브러리함수의오류번호얻기 errno 변수기능오류번호를저장한다. 기본형 extern int errno; 헤더파일 라이브러리함수호출에실패했을때함수예 정수값을반환하는함수 -1 반환 open 함수 포인터를반환하는함수 NULL 반환 fopen 함수 2 유닉스 / 리눅스 라이브러리함수의오류번호얻기 19-1

More information

Poison null byte Excuse the ads! We need some help to keep our site up. List 1 Conditions 2 Exploit plan 2.1 chunksize(p)!= prev_size (next_chunk(p) 3

Poison null byte Excuse the ads! We need some help to keep our site up. List 1 Conditions 2 Exploit plan 2.1 chunksize(p)!= prev_size (next_chunk(p) 3 Poison null byte Excuse the ads! We need some help to keep our site up. List 1 Conditions 2 Exploit plan 2.1 chunksize(p)!= prev_size (next_chunk(p) 3 Example 3.1 Files 3.2 Source code 3.3 Exploit flow

More information

MPLAB C18 C

MPLAB C18 C MPLAB C18 C MPLAB C18 MPLAB C18 C MPLAB C18 C #define START, c:\mcc18 errorlevel{0 1} char isascii(char ch); list[list_optioin,list_option] OK, Cancel , MPLAB IDE User s Guide MPLAB C18 C

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Development Environment 2 Jo, Heeseung make make Definition make is utility to maintain groups of programs Object If some file is modified, make detects it and update files related with modified one It

More information

Chapter 4. LISTS

Chapter 4. LISTS C 언어에서리스트구현 리스트의생성 struct node { int data; struct node *link; ; struct node *ptr = NULL; ptr = (struct node *) malloc(sizeof(struct node)); Self-referential structure NULL: defined in stdio.h(k&r C) or

More information

UI TASK & KEY EVENT

UI TASK & KEY EVENT T9 & AUTOMATA 2007. 3. 23 PLATFORM TEAM 정용학 차례 T9 개요 새로운언어 (LDB) 추가 T9 주요구조체 / 주요함수 Automata 개요 Automata 주요함수 추후세미나계획 질의응답및토의 T9 ( 2 / 30 ) T9 개요 일반적으로 cat 이라는단어를쓸려면... 기존모드 (multitap) 2,2,2, 2,8 ( 총 6번의입력

More information

제1장 Unix란 무엇인가?

제1장  Unix란 무엇인가? 1 시그널 2 11.1 시그널 시그널 시그널은예기치않은사건이발생할때이를알리는소프트웨어인터럽트이다. 시그널발생예 SIGFPE 부동소수점오류 SIGPWR 정전 SIGALRM 알람시계울림 SIGCHLD 자식프로세스종료 SIGINT 키보드로부터종료요청 (Ctrl-C) SIGSTP 키보드로부터정지요청 (Ctrl-Z) 3 주요시그널 시그널이름 의미 기본처리 SIGABRT

More information