Linux(20)
-
Linux kernel process
Process 프로세스는 실행 중인 프로그램 프로세스는 사용 중인 파일, 대기 중인 시그널, 커널 내부 데이터, 프로세서 상태, 하나 이상의 물리적 메모리 영역이 할당된 메모리 주소 공간, 실행 중인 하나 이상의 스레드 정보, 전역 데이터가 저장된 데이터 부분등 모든 자원을 포함하는 개념traditional process 전통적인 유닉스 시스템에서 프로세스가 하나의 thread로 구성된다. 리눅스는 process와 thread를 구분하지 않는다. thread는 각자 고유한 가상 processor를 할당받지만 (context 관리, cpuinfo handle 의미) virtual memory는 공유 프로세스는 작동 중인 program 및 그와 관련된 자원을 의미 how to create a process ..
2021.12.31 -
kernel에서 user level로 uevent 보내는 법 (how to send an uevent to the user space)
아래 코드는 native에서 uevent를 처리하는 example 입니다. 1. kernel level (f_accessory.c file 참고) /* file operationsfor /dev/usb_accessory */ static const structfile_operations acc_fops = { .owner = THIS_MODULE, .read = acc_read, .write = acc_write, .unlocked_ioctl = acc_ioctl, .open = acc_open, .release = acc_release, }; static structmiscdevice acc_device = { .minor = MISC_DYNAMIC_MINOR, .name = "usb_accessory..
2021.12.31 -
Linux kernel Bottom half 정리 (softirq, tasklet, workqueue) - part 2
* softirq 사용 linux/interrupt.h enum { HI_SOFTIRQ=0, TIMER_SOFTIRQ, NET_TX_SOFTIRQ, NET_RX_SOFTIRQ, BLOCK_SOFTIRQ, BLOCK_IOPOLL_SOFTIRQ, TASKLET_SOFTIRQ, SCHED_SOFTIRQ, HRTIMER_SOFTIRQ, high resolution timer RCU_SOFTIRQ, worklis.next, struct work_struct, entry); f = work->func; list_del_init(swq>worklist.next);
2021.12.31 -
Linux kernel Bottom half 정리 (softirq, tasklet, workqueue) - part 1
* bottom half 사용 이유 1. 다른 코드를 너무 오래 동안 중단시켜서는 안 됨 2. 처리 중인 interrupt를 비활성화 시킨 상태에서, 최악의 경우 IRQF_DISABLED가 설정되지 않은 경우, 현재 procesor의 모든 interrut를 비활성화 시킨 상태에서 실행 됨 즉, 오래 걸리면 interrupt가 무시될 수 있음 3. 휴면 상태가 될 수 없음 cf. 일반적인 bottom half는 tasklet을이용해 구현하는 것이 좋다. 1) 동적생성 가능 2) 빠른편 3) 사용이간단 (multi-processor에대한 신경을 안 써도 됨) state를 둬서 이미 실행 중인 것은 실행 안 하게 함 ISR은 interrupt 수신상태를 확인 등의 간단한 작업만 수행해야 함 그래야 interr..
2021.12.14 -
virtual address space
최대 4GB (archi. dep.) 접근 불가 영역도 존재 ex. 08048000 - 0804c000 prcess에게 접근 권한이 없는 메모리 주소 영역 유효한 주소의 이런 영역을 -> 메모리 영역이라고 함 segment fault 유효하지 않은 영역에 access 시 발생 memory section types 1) text section (RO) 2) data section (RW) 실행 파일의 초기값이 있는 전역 변수가 할당된 메모리 3) zero page (BSS) 초기값이 없는 전역 변수가 들어 있는 영역 4) process user space stack 5) C lib용 text, data, BSS sections 6) memory 할당 file 영역 7) 공유 메모리 구간 8) malloc ..
2021.12.13 -
process scheduling
Process scheduling linux에 관한 내용 지금까지는함수 명은 linux에 dependent하지만, 내용은 일반적인 내용 이었는데, 본 내용은 linux dependent한 내용이다. Linux의 scheduler -Non-Retal-Time scheduler -Real-Time Scheduler real time으로비춰지지는 않는다. Linux scheduling 1. Time sharing (SCHED_NORMAL; SCHED_OTHER) ready ---> run---> Exit TASK_RUNNING --------------> TASK_RUNNING ------> TASK 종료 task 생성 ^ ^ schedule() | | do_exit | | context_switch() | ..
2021.12.13