Microsoft PowerPoint - chap2

Size: px
Start display at page:

Download "Microsoft PowerPoint - chap2"

Transcription

1 제 2 장. 파일입출력 (File I/O) 숙대창병모 1

2 목표 파일의구조및특성을이해한다. 파일을열고닫는다. 파일로부터데이터를읽고쓴다. 파일현재위치변경 기타파일제어 숙대창병모 2

3 2.1 파일구조 숙대창병모 3

4 What is a file? a file is a contiguous sequence of bytes no format imposed by the operating system each byte is individually addressable in a disk file a file is also a uniform interface to external devices 숙대창병모 4

5 File Descriptor File descriptor open() returns a fd, an integer value 열린파일을나타내는번호 used in subsequent I/O operations on that file close(fd) closes that file described by fd all of a process's open files are automatically closed when it terminates 숙대창병모 5

6 File Descriptor file descriptor : 0 ~ 19 Value Meaning 0 standard input 1 standard output 2 standard error fds for users 숙대창병모 6

7 User and Kernel Mode User process result=open( /usr/glass/file.txt, O_RDONLY); User code Kernel Address of kernel close() Address of kernel open() Address of kernel write() open(char *name, int mode) { <Place parameters in registers> <Execute trap instruction, switching to kernel code > <Return result of system call> } C runtime library kernel code for open() { <Manipulate kernel data> 숙대창병모 7... <Return to user code> } Kernel system call code

8 Inode (Index node) 한파일은하나의 i-node 를갖는다. 파일에대한모든정보를가지고있음 file type : regular, directory, block special, character special, etc file size file permissions the owner and group ids the last modification and last access times if it's a regular or directory, the location of data blocks if it's a special file, device numbers if it's a symbolic link, the value of the symbolic link 숙대창병모 8

9 파일을위한커널자료구조 fd= open( file, O_RDONLY); Fd table (per process) Open file table Active inode table Disk File pos refcnt=1 File access Inode list... File size File type Data blocks... 숙대창병모 9

10 Process table entry 프로세스테이블 (Process table) 커널 (kernel) 자료구조 프로세스목록 프로세스 프로세스테이블항목 프로세스테이블항목 (Process table entry) 파일디스크립터배열 (file descriptor array) 포함 fd array 숙대창병모 10

11 Open File Table 파일테이블 (file table) 커널자료구조 열려진모든파일목록 열려진파일 파일테이블의항목 파일테이블항목 (file table entry) 파일상태플래그 (read, write, append, sync, nonblocking, ) 파일의현재위치 (current file offset) i-node에대한포인터 숙대창병모 11

12 Active i-node table Active i-node table 커널내의자료구조 Open 된파일들의 i-node 를저장하는테이블 i-node 하드디스크에저장되어있는파일에대한자료구조 한파일에하나의 i-node 하나의파일에대한정보저장 소유자, 크기 파일이위치한장치 파일내용디스크블럭에대한포인터 i-node table vs. i-node 숙대창병모 12

13 2.2 파일관련시스템호출 open() - 열기 creat() - 파일생성 close() - 닫기 read() - 읽기 write() - 쓰기 lseek() - 이동 숙대창병모 13

14 open() - 열기 #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> int open (const char *pathname, int oflag, [ mode_t mode ]); 파일을연다 파일이없으면경우에따라새로만들어질수도있다 리턴값 : 파일디스크립터 (file descriptor), 실패하면 -1 pathname : 파일의이름 mode : 파일의 access permission 값. 생략가능. 새로운파일을만드는경우에만사용됨 creat() 함수설명참조 숙대창병모 14

15 open() 의파라미터 두번째파라미터 oflag 는다음상수들의 OR 이다 예 int fd; fd = open("afile", O_RDWR O_CREAT, 0600 ); 반드시하나지정해주어야할값 O_RDONLY : 읽기모드, write 함수를사용할수없음 O_WRONLY : 쓰기모드, read 함수를사용할수없음 O_RDWR : 읽고쓰기모드, read write 사용가능 숙대창병모 15

16 open() 의파라미터 선택적지정가능 O_APPEND: 모든 write 된데이터는파일의끝에추가 O_CREAT : 파일이없는경우파일생성세번째인자 mode O_EXCL : O_CREAT 이고그파일이이미있으면에러 O_TRUNC : 파일이있는경우파일크기를 0 으로만든다 O_NONBLOCK : nonblocking 모드로입출력을함 O_SYNC : 각 write 함수호출은디스크에물리적으로쓰여진후리턴한다 숙대창병모 16

17 예제 : open.c /* open.c */ #include <stdlib.h> #include <fcntl.h> #include <unistd.h> int main() { int fd; char fname[] = "afile"; } if ((fd = open (fname, O_RDWR)) == -1) perror(fname); printf("%s is opened.\n", fname); close(fd); return 0; 숙대창병모 17

18 creat () - 파일생성 #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> int creat ( const char *pathname, mode_t mode ); 새로운파일을생성한다 리턴값 : 파일디스크립터, 실패하면 -1 pathname : 생성하고자하는파일의이름 mode : 파일의 access permission 값 숙대창병모 18

19 creat () 의파라미터 두함수호출은동일 fd = creat ( pathname, mode ); fd = open ( pathname, O_WRONLY O_CREAT O_TRUNC, mode); 두번째인자 mode 는 permission mode 예 숙대창병모 19

20 close () - 닫기 #include <unistd.h> int close ( int fd ); 작업이끝난후파일을닫는다. 리턴값 : 성공하면 0, 실패하면 -1 fd : 닫고자하는파일의파일디스크립터 프로세스가종료되면모든열려진화일들은자동적으로닫힌다 숙대창병모 20

21 read () - 읽기 #include <unistd.h> ssize_t read ( int fd, void *buf, size_t nbytes ); fd가나타내는파일에서데이터를읽는다 리턴값 : buf 성공하면읽은바이트수 파일의끝을만나면 0 실패하면 -1 읽은데이터를저장할메모리의시작주소 nbytes 읽을데이터의바이트수 숙대창병모 21

22 read () - 읽기 읽을데이터가충분하면한번에 nbytes 만큼읽는다. 읽을데이터가 nbytes 보다적으면더적게읽는다. 파일의끝에서 네트웍입출력에서 size_t : unsigned integer ssize_t : signed integer 숙대창병모 22

23 예제 /* count.c: 파일의문자수를센다 */ #include <stdlib.h> #include <fcntl.h> #include <unistd.h> #define BUFSIZE 512 int main() { char buffer[bufsize]; int fd; ssize_t nread; long total = 0; } if ((fd = open("afile", O_RDONLY)) == -1) perror("afile"); /* 파일의끝에도달할때까지반복 */ while( (nread = read(fd, buffer, BUFSIZE)) > 0) total += nread; close(fd); printf ("total chars in afile: %ld\n", total); return 0; 숙대창병모 23

24 write() - 쓰기 #include <unistd.h> ssize_t write (int fd, void *buf, size_t nbytes); fd가나타내는파일에데이터를쓴다 리턴값 buf 성공하면, 파일에쓰여진데이터의바이트수 실패하면, -1 쓸데이터를저장하고있는메모리의시작주소 nbytes 쓸데이터의바이트의수 숙대창병모 24

25 예 : Copy Files #include <stdio.h> #include <fcntl.h> main(argc, argv) int argc; char *argv[ ]; { int fdin, fdout, n; char buf[bufsize]; if (argc!= 3) { fprintf(stderr,"usage: %s filein fileout\n",argv[0]); exit(1); } if ((fdin = open(argv[1], O_RDONLY)) == -1) { perror(argv[1]); exit(2); } if ((fdout=open(argv[2],o_wronly O_CREAT O_TRUNC, 0644))==-1){ perror(argv[2]); exit(3);} } while ((n = read(fdin, buf, BUFSIZE)) > 0) write(fdout, buf, n); exit(0); 숙대창병모 25

26 lseek() - 이동 #include <sys/types.h> #include <unistd.h> off_t lseek (int fd, off_t offset, int whence ); 파일의현재위치 (current file offset) 를이동 성공하면현재위치를리턴, 실패하면 -1 whence : 위치기준점 SEEK_SET : 파일의시작점을기준으로이동 SEEK_CUR : 현재위치를기준으로이동 SEEK_END : 파일의끝을기준으로이동 offset : 기준점에서의상대적인거리 (byte 단위 ) SEEK_CUR, SEEK_END 와같이쓰일때는음수도가능 숙대창병모 26

27 lseek() 이동 파일의현재위치 (current file offset) 파일을처음열면현재위치는 0 즉파일의시작 파일에대한읽기 / 쓰기는파일의현재위치에서실행된다 읽기 / 쓰기후파일의현재위치는읽기 / 쓰기한 byte 수만큼자동적으로뒤로이동 lseek() 임의의위치로파일의현재위치를이동할수있다 숙대창병모 27

28 예 :lseek rewind append lseek(fd, 0L, 0); lseek(fd, 0L, 2); record position loc = lseek(fd, 0L, 1); increase file lseek(fd, (long) MAX*sizeof(record), 2); write(fd, (char *) &reocrd, sizeof(record)); 숙대창병모 28

29 예제 : /* lseek.c */ #include <unistd.h> int main() { if (lseek(stdin_fileno, 0, SEEK_CUR) == -1) printf("cannot seek\n"); else printf("seek OK\n"); return 0; } 숙대창병모 29

30 예제 : /* lseek1.c */ #include <unistd.h> /* lseek1.c */ #include <fcntl.h> char char buf1[] = "abcdefghij"; buf2[] = "ABCDEFGHIJ"; int main() { int fd; } if ( (fd = creat("file.hole", 0644)) < 0) perror("file.hole"); if (write(fd, buf1, 10)!= 10) /* offset now = 10 */ perror("buf1"); if (lseek(fd, 40, SEEK_SET) == -1) /* offset now = 40 */ perror("lseek"); if (write(fd, buf2, 10)!= 10) /* offset now = 50 */ perror("buf2"); return 0; 숙대창병모 30

31 예제 : /* lseek1.c */ lseek1.c 의출력파일 file.hole 의내용 a b c d e f g h i j 10 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 20 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 30 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 40 A B C D E F G H I J 숙대창병모 31

32 예제 : /* lseek2.c */ #include <sys/types.h> /* lseek2.c */ #include <unistd.h> #include <fcntl.h> int main() { int fd; off_t fsize; char buf[11]; } if((fd=open("file.hole", O_RDONLY)) < 0) perror("file.hole"); fsize = lseek(fd, 0, SEEK_END); printf("size: %lu\n", fsize); lseek(fd, 40, SEEK_SET); read(fd, buf, 10); buf[10] = \0 ; puts(buf); return 0; 숙대창병모 32

33 레코드수정 struct XXX record; read(fd, (char *) &record, sizeof(record)); update record lseek(fd, (long) -sizeof(record), 1); write(fd, (char *) &record, sizeof(record)); 숙대창병모 33

34 레코드수정 record READ current file offset 숙대창병모 34

35 레코드수정 record LSEEK current file offset 숙대창병모 35

36 레코드수정 record WRITE current file offset 숙대창병모 36

37 2.3 시스템호출구현 숙대창병모 37

38 Block I/O I/O is always done in terms of blocks Sequence of a read() system call read() system call trap n bytes the device driver (software in kernel) I/O request one block at a time interrupt the disk controller (hardware) 숙대창병모 38

39 A Typical Hardware System CPU chip register file ALU system bus memory bus bus interface I/O bridge main memory USB controller graphics adapter I/O bus disk controller Expansion slots for other devices such as network adapters. mousekeyboard monitor disk 숙대창병모 39

40 Reading a Disk Sector: Step 1 CPU chip register file ALU CPU initiates a disk read by writing a command, logical block number, and destination memory address to a port (address) associated with disk controller. bus interface main memory I/O bus USB controller graphics adapter disk controller mousekeyboard monitor disk 숙대창병모 40

41 Reading a Disk Sector: Step 2 CPU chip register file ALU Disk controller reads the sector and performs a direct memory access (DMA) transfer into main memory. bus interface main memory I/O bus USB controller graphics adapter disk controller mousekeyboard monitor disk 숙대창병모 41

42 Reading a Disk Sector: Step 3 CPU chip register file ALU When the DMA transfer completes, the disk controller notifies the CPU with an interrupt (i.e., asserts a special interrupt pin on the CPU) bus interface main memory I/O bus USB controller graphics adapter disk controller mousekeyboard monitor disk 숙대창병모 42

43 I/O 효율 디스크는메모리에비해서매우느린장치 성능을위해서디스크 I/O의횟수최소화가바람직 적은양을여러번 I/O 하는것보다 많은양을 I/O 하여횟수를줄이는것이좋다 write1.c 에서 BUFFSIZE 값을변경하며수행시간을 측정 8192 까지는 BUFFSIZE 가클수록성능이향상 8192 보다큰경우는성능에변화가없다 숙대창병모 43

44 I/O 효율 BSD fast file system 의 I/O 단위는 8192 바이트 BUFSIZE 가 8192 보다큰경우 내부 I/O 의단위는 8192 이므로성능의향상이없다 BUFSIZE 가 8192 의배수가아닌경우는 오히려 8192 인경우보다 I/O 횟수가많아져 성능이하락할수있다 숙대창병모 44

45 예제 : /* write1.c */ #include <sys/types.h> /* write1.c */ #include <sys/stat.h> #include <fcntl.h> #define BUFFSIZE 512 #define FILESIZE (100 * 1024 * 1024) #define COUNT FILESIZE / BUFFSIZE int main() { int i, fd; char buf[buffsize]; } memset(buf, '.', BUFFSIZE); if ((fd = creat("file.write", 0600)) < 0) perror("file.write"); for (i=0; i < COUNT; ++i) write(fd, buf, BUFFSIZE); close(fd); return 0; 숙대창병모 45

46 숙대창병모 ,072 1, ,536 3, ,768 6, ,384 12, ,192 25, ,096 51, , , , , , , ,638, ,276, ,553, ,107, ,214, ,428, ,857,600 1, , #loops Clock time (seconds) System CPU (seconds) User CPU (seconds) BUFFSIZE 예제 : /* write1.c */

47 read/write 구현 read/write 시스템호출 file table entry 의 file position 값이읽은 / 쓰여진바이트수만큼증가 파일크기증가 Write 후 file position 이 i-node 의 file size 보다크면파일크기증가 파일을 O_APPEND 로열면 먼저 file position 을 i-node 의 file size 값으로설정한후 write 수행 따라서모든 write 는파일의끝에덧붙여진다. 숙대창병모 47

48 read/write 시스템호출구현 Fd table (per process) Open file table Active inode table Disk File pos refcnt=1 File access Inode list... File size File type Data blocks... 숙대창병모 48

49 Example read(fd, buf1, 100); copy the first block from disk into an buffer copy the first 100 bytes from the buffer into buf1 offset <- 100 read(fd, buf2, 200); copy the next 200 bytes from the buffer into buf2 read(fd, buf3, 5000); copy the remaning (3796bytes) from the buffer to buf3 copy the second block from disk into an buffer copy the remainig(1204 bytes) from the buffer into buf3 write(fd, buf4, 100); write(fd, buf5, 4000); 숙대창병모 49

50 lseek 구현 lseek 시스템호출 file table entry 의 current file offset 값을변경 disk I/O 는없음 SEEK_END 를사용하여파일의끝으로이동하면 file table entry 의 current file offset 값은 i-node 의파일크기값으로설정됨 숙대창병모 50

51 lseek 구현 lseek(fd, 300, L_SET) Fd table (per process) Open file table Active inode table Disk File pos=300 refcnt=1 File access Inode list... File size File type Data blocks... 숙대창병모 51

52 2.4 파일공유 숙대창병모 52

53 dup(), dup2() #include <unistd.h> int dup (int fd); int dup2 (int fd, int fd2); 사용중인파일디스크립터의복사본을만듦 dup() 는새파일디스크립터번호가할당됨 dup2() 는 fd2 를사용 리턴값 성공하면복사된새파일디스크립터, 실패하면 -1 dup() 함수는할당가능한가장작은번호를리턴한다. dup2() 함수는 fd2 를리턴한다. 숙대창병모 53

54 dup 구현 fd2 = dup(3); Fd table (per process) Open file table Active inode table Disk 0 1 Inode list File pos=300 refcnt=2 File access... File size File type Data blocks... 숙대창병모 54

55 dup 구현 fd2 = dup(3); Fd table (per process) Open file table Active inode table Disk 0 1 Inode list File pos=300 refcnt=2 File access... File size File type Data blocks... 숙대창병모 55

56 #include <fcntl.h> #include <unistd.h> int main() { int fd1, fd2, n; char buf[11]; } 예제 /* dup.c */ if ((fd1 = open("afile", O_RDONLY)) < 0) perror("afile"); if ((fd2 = dup(fd1)) < 0) error("dup"); n = read(fd1, buf, 10); buf[n] = \0 ; puts(buf); n = read(fd2, buf, 10); buf[n] = \0 ; puts(buf); close(fd1); close(fd2); return 0; 숙대창병모 56

57 dup2() newfd = dup2(3,1); 호출후 리턴값은 1 file table 의 file position 과 fd status flags 는공유됨 file descriptors 의 fd flags 는공유안됨 숙대창병모 57

58 dup2(3,1) 구현 Fd table (per process) Open file table Active inode table Disk File pos refcnt=1... File pos refcnt=1 File access File size File type... File access File size File type... Inode list Data blocks... 숙대창병모 58

59 dup2(3,1) 구현 Fd table (per process) Open file table Active inode table Disk File pos refcnt=1... File pos refcnt=1 File access File size File type... File access File size File type... Inode list Data blocks... 숙대창병모 59

60 dup(), dup2() 의용도 표준입출력의 redirection 표준입출력대상을파일로바꿈 표준입출력의파일디스크립터 #include <unistd.h> #define STDIN_FILENO 0 /* 표준입력 */ #define STDOUT_FILENO 1 /* 표준출력 */ #define STDERR_FILENO 2 /* 표준에러 */ 숙대창병모 60

61 예제 : /* dup1.c */ #include <unistd.h> #include <fcntl.h> #include <stdio.h> int main() { int fd; } if((fd = creat("afile", 0600)) == -1) perror("afile"); printf("this is displayed on the screen.\n"); dup2(fd, STDOUT_FILENO); printf("this is written into the redirected file.\n"); return 0; 숙대창병모 61

62 예제 : /* dup2.c */ #include <unistd.h> #include <fcntl.h> #include <stdio.h> int main() { int fd; } if((fd = creat("afile", 0600)) == -1) perror("afile"); printf("this is displayed on the screen.\n"); close(stdout_fileno); dup(fd); printf("this is written into the redirected file.\n"); return 0; 숙대창병모 62

63 open() 두번 같은파일두번 open( file, O_RDONLY); file position 은공유되지않는다 Fd table (per process) Open file table Active inode table Disk 0 1 Inode list File pos refcnt=1... File access File pos File size File type... Data blocks refcnt=1... 숙대창병모 63

64 예제 /* open2.c */ #include <fcntl.h> /* open2.c */ #include <unistd.h> int main() { int fd1, fd2, n; char buf[11]; fd1 = open("afile", O_RDONLY); fd2 = open("afile", O_RDONLY); if (fd1 < 0 fd2 < 0) perror("afile"); n = read(fd1, buf, 10); buf[n] = \0 ; puts(buf); n = read(fd2, buf, 10); buf[n] = \0 ; puts(buf); } close(fd1); close(fd2); return 0; 숙대창병모 64

65 두프로세스에서같은파일 open() Fd table(per process) Open 0 file table File pos 4 refcnt=2 Active inode table Disk Inode list... File access File pos refcnt=2... File size File type... Data blocks 숙대창병모 65

66 fork() Fd table (per process) Open file table File pos Active inode table Disk Inode list refcnt=2 File access File size File type... Data blocks 숙대창병모 66

Microsoft PowerPoint APUE(File InO).pptx

Microsoft PowerPoint APUE(File InO).pptx Linux/UNIX Programming 문양세강원대학교 IT대학컴퓨터과학전공 강의목표및내용 강의목표 파일의특성을이해한다. 파일을열고닫는다. 파일로부터데이터를읽고쓴다. 기타파일제어함수를익힌다. 강의내용 파일구조 (UNIX 파일은어떤구조일까?) 파일관련시스템호출 시스템호출의효율과구조 Page 2 What is a File? A file is a contiguous

More information

Microsoft PowerPoint APUE(File InO).ppt

Microsoft PowerPoint APUE(File InO).ppt 컴퓨터특강 () [Ch. 3] 2006 년봄학기 문양세강원대학교컴퓨터과학과 강의목표및내용 강의목표 파일의특성을이해한다. 파일을열고닫는다. 파일로부터데이터를읽고쓴다. 기타파일제어함수를익힌다. 강의내용 파일구조 (UNIX 파일은어떤구조일까?) 파일관련시스템호출 시스템호출의효율과구조 Page 2 1 What is a File? A file is a contiguous

More information

Microsoft PowerPoint APUE(File InO)

Microsoft PowerPoint APUE(File InO) Linux/UNIX Programming 문양세강원대학교 IT특성화대학컴퓨터과학전공 강의목표및내용 강의목표 파일의특성을이해한다. 파일을열고닫는다. 파일로부터데이터를읽고쓴다. 기타파일제어함수를익힌다. 강의내용 파일구조 (UNIX 파일은어떤구조일까?) 파일관련시스템호출 시스템호출의효율과구조 Page 2 What is a File? A file is a contiguous

More information

슬라이드 1

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

More information

제1장 Unix란 무엇인가?

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

More information

제12장 파일 입출력

제12장 파일 입출력 제 4 장파일입출력 리눅스시스템프로그래밍 청주대학교전자공학과 한철수 1 시스템호출 (system call) 파일 (file) 임의접근 (random access) 주요학습내용 2 4.1 절 커널의역할 (kernel) 커널 (kernel) 은운영체제의핵심부분으로서, 하드웨어를운영관리하는여러가지서비스를제공함 파일관리 (File management) 디스크 프로세스관리

More information

로봇SW교육원 강의자료

로봇SW교육원 강의자료 UNIT 06 저수준파일입출력 로봇 SW 교육원 최상훈 (shchoi82@gmail.com) 학습목표 2 저수준파일입출력함수 리눅스파일시스템의이해 다양한파일입출력실습을통한프로그램능력향상 파일시스템 3 리눅스파일시스템의특징 / 로시작하는트리구조 / (root) usr home bin local bin lib 열린파일에대한커널내부자료구조 4 프로세스테이블 파일테이블

More information

로봇SW교육원 강의자료

로봇SW교육원 강의자료 UNIT 06 파일 I/O 로봇 SW 교육원 3 기 학습목표 2 저수준파일입출력함수를사용핛수있다. 리눅스파일시스템을이해핚다. 다양핚파일입출력실습을통해프로그램능력을향상핚다. 파일디스크립터 3 파일디스크립터를통해파일의 I/O처리 음이아닊정수 표준입력, 표준출력, 표준에러의파일서술자 unistd.h STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO

More information

제1장 Unix란 무엇인가?

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

More information

Microsoft PowerPoint - chap12 [호환 모드]

Microsoft PowerPoint - chap12 [호환 모드] 제 12 장고급입출력 Nov 2007 숙대창병모 1 Contents 1. Nonblocking I/O 2. Record Locking 3. Memory Mapped I/O Nov 2007 숙대창병모 2 12.1 Nonblocking I/O Nov 2007 숙대창병모 3 Nonblocking I/O Blocking I/O I/O 작업완료를기다리며영원히리턴안할수있다

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

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

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

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

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

歯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

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

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

Microsoft PowerPoint - 09_FileSystem

Microsoft PowerPoint - 09_FileSystem Linux 파일시스템프로그래밍 File System Programming - 파일시스템내부구조 - File Descriptor - File 기본작업시스템호출 - File 정보관리시스템호출 - Directory 관리시스템호출 이제부터는 시스템사용에만머물지않는다. 내부로들어가서건드려보고나만의시스템을만들자. 시스템호출 ( 또는표준 API) 을이용하여운영체제기능을프로그램에서사용

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

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

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

More information

2009년 상반기 사업계획

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

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

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

<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

<4D F736F F F696E74202D FB8DEB8F0B8AE20B8C5C7CE205BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D FB8DEB8F0B8AE20B8C5C7CE205BC8A3C8AF20B8F0B5E55D> 학습목표 통신프로그램이무엇인지이해한다. 을이용한 IPC 기법을이해한다. 함수를사용해프로그램을작성할수있다. IT CookBook, 유닉스시스템프로그래밍 2/20 목차 의개념 함수 해제함수 의보호모드변경 파일의크기확장 매핑된메모리동기화 데이터교환하기 의개념 파일을프로세스의메모리에매핑 프로세스에전달할데이터를저장한파일을직접프로세스의가상주소공간으로매핑 read, write

More information

2009년 상반기 사업계획

2009년 상반기 사업계획 메모리매핑 IT CookBook, 유닉스시스템프로그래밍 학습목표 통신프로그램이무엇인지이해한다. 메모리매핑을이용한 IPC 기법을이해한다. 메모리매핑함수를사용해프로그램을작성할수있다. 2/20 목차 메모리매핑의개념 메모리매핑함수 메모리매핑해제함수 메모리매핑의보호모드변경 파일의크기확장 매핑된메모리동기화 데이터교환하기 3/20 메모리매핑의개념 메모리매핑 파일을프로세스의메모리에매핑

More information

Microsoft PowerPoint - chap4 [호환 모드]

Microsoft PowerPoint - chap4 [호환 모드] 제 5 장 C 표준라이브러리 숙대창병모 1 목표 C 표준라이브러리의깊이있는이해 시스템호출과 C 표준라이브러리관계 숙대창병모 2 C 입출력라이브러리함수 숙대창병모 3 시스템호출과라이브러리함수 System Calls well defined entry points directly into the kernel documented in section 2 of the

More information

Microsoft PowerPoint - chap13-입출력라이브러리.pptx

Microsoft PowerPoint - chap13-입출력라이브러리.pptx #include int main(void) int num; printf( Please enter an integer: "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); return 0; 1 학습목표 스트림의 기본 개념을 알아보고,

More information

2009년 상반기 사업계획

2009년 상반기 사업계획 파일입출력 IT CookBook, 유닉스시스템프로그래밍 학습목표 유닉스에서파일입출력의특징을이해한다. 저수준파일입출력함수를사용할수있다. 고수준파일입출력함수를사용할수있다. 임시파일을생성해파일입출력을할수있다. 2/51 목차 저수준파일입출력 파일기술자 파일생성과열고닫기 파일읽기와쓰기 파일오프셋지정 파일기술자복사 파일기술자제어 파일삭제 고수준파일입출력 파일포인터 파일열기와닫기

More information

<4D F736F F F696E74202D FC6C4C0CF20C0D4C3E2B7C2205BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D FC6C4C0CF20C0D4C3E2B7C2205BC8A3C8AF20B8F0B5E55D> 학습목표 유닉스에서파일입출력의특징을이해한다. 저수준파일입출력함수를사용할수있다. 고수준파일입출력함수를사용할수있다. 임시파일을생성해파일입출력을할수있다. 파일입출력 IT CookBook, 유닉스시스템프로그래밍 2/45 목차 저수준파일입출력 파일기술자 파일생성과열고닫기 파일읽기와쓰기 파일오프셋지정 파일기술자복사 파일기술자제어 파일삭제 고수준파일입출력 파일포인터 파일열기와닫기

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

BMP 파일 처리

BMP 파일 처리 BMP 파일처리 김성영교수 금오공과대학교 컴퓨터공학과 학습내용 영상반전프로그램제작 2 Inverting images out = 255 - in 3 /* 이프로그램은 8bit gray-scale 영상을입력으로사용하여반전한후동일포맷의영상으로저장한다. */ #include #include #define WIDTHBYTES(bytes)

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

/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

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 - Lecture 4-1 Linux File Environment.ppt [호환 모드]

Microsoft PowerPoint - Lecture 4-1 Linux File Environment.ppt [호환 모드] Liux Programmig Sprig 2008 File Hadlig Importat cotets Liux 에서 C 컴파일방법 File 처리프로그래밍 Liux 환경접근프로그래밍 Kogju Natioal Uiversity Liux System Programmig 2/29 Basic compilig method Liux C Compiler : gcc, cc 기본

More information

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

금오공대 컴퓨터공학전공 강의자료 C 프로그래밍프로젝트 Chap 24. 파일입출력 2013.11.27. 오병우 컴퓨터공학과 파일 (File) 입출력 표준입출력 vs. 파일입출력 HDD 프로그래머입장에서는동일한방법으로입출력 다만 file 을읽고쓰기전에 Open 해서스트림에대한파일포인터 (file pointer) 를얻어야한다. OS 가실제작업을대행하며, 프로그래머는적절한함수를적절한방법으로호출 Department

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

제1장 Unix란 무엇인가?

제1장  Unix란 무엇인가? 5 장파일시스템 상지대학교컴퓨터공학과고광만 kkman@sangji.ac.kr http://compiler.sangji.ac.kr 2018 5.1 파일시스템구현 파일시스템구조 0 1 2 3 200 201 부트블록슈퍼블록 i-노드 1..40 i-노드 41..80... 데이터블록데이터블록... i- 리스트 데이터블록 데이터블록 3 파일시스템구조 부트블록 (Boot

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 File I/O Jo, Heeseung 학습목표 오류처리함수동적메모리할당명령행인자 2 오류처리함수 [1] 오류메시지출력 : perror(3) #include void perror(const char *s); [ 예제 1-4] perror 함수사용하기 01 #include 02 #include 03

More information

좀비프로세스 2

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

More information

Microsoft Word - MPC850 SPI Driver.doc

Microsoft Word - MPC850 SPI Driver.doc MPC850 SPI Driver 네트워크보드에서구현한 SPI Device Driver 제작및이용방법입니다. 문서작성 : 이재훈 (kingseft.lee@samsung.com) 이용한 SPI EEPROM - X5043/X5045 512 x 8 bit SPI EEPROM (4Kbits = 512bytes) - 제조사 : XICOR (www.xicor.com) -

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

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

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 파일입출력 Heeseung Jo 이장의내용 파일과파일포인터 파일입출력함수 임의접근파일처리 2 파일과파일포인터 파일 파일은모든데이터를연속된바이트형태로저장 4 C 언어의파일종류 텍스트파일 (text file) 사람들이읽을수있는문자들을저장하고있는파일 텍스트파일에서 " 한줄의끝 " 을나타내는표현은파일이읽어들여질때, C 내부의방식으로변환 예, a.txt, main.c,

More information

2007_2_project4

2007_2_project4 Programming Methodology Instructor: Kyuseok Shim Project #4: external sort with template Due Date: 0:0 a.m. between 2007-12-2 & 2007-12-3 Introduction 이프로젝트는 C++ 의 template을이용한 sorting algorithm과정렬해야할데이터의크기가

More information

Microsoft PowerPoint - [2009] 02.pptx

Microsoft PowerPoint - [2009] 02.pptx 원시데이터유형과연산 원시데이터유형과연산 원시데이터유형과연산 숫자데이터유형 - 숫자데이터유형 원시데이터유형과연산 표준입출력함수 - printf 문 가장기본적인출력함수. (stdio.h) 문법 ) printf( Test printf. a = %d \n, a); printf( %d, %f, %c \n, a, b, c); #include #include

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 오픈소스소프트웨어개발입문 (CP33992) 파일입출력 부산대학교공과대학정보컴퓨터공학부 학습목표 파일의기본개념과특징을이해할수있다. 파일처리과정을이해할수있다. 형식을지정한파일입출력함수의사용법을알수있다. 2 파일과파일포인터 3 파일 C 의파일은모든데이터를연속된바이트형태로저장한다. 4 텍스트파일 (text file) C 언어의파일종류 사람들이읽을수있는문자들을저장하고있는파일

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

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

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 ERROR AND COMMAND LINE ARGUMENTS Jo, Heeseung 학습목표 오류처리함수 동적메모리할당 명령행인자 2 오류처리함수 [1] 오류메시지출력 : perror(3) #include void perror(const char *s); [ 예제 1-4] perror 함수사용하기 01 #include

More information

OPCTalk for Hitachi Ethernet 1 2. Path. DCOMwindow NT/2000 network server. Winsock update win95. . . 3 Excel CSV. Update Background Thread Client Command Queue Size Client Dynamic Scan Block Block

More information

슬라이드 1

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

More information

<C0CCBCBCBFB52DC1A4B4EBBFF82DBCAEBBE7B3EDB9AE2D313939392D382E687770>

<C0CCBCBCBFB52DC1A4B4EBBFF82DBCAEBBE7B3EDB9AE2D313939392D382E687770> i ii iii iv v vi 1 2 3 4 가상대학 시스템의 국내외 현황 조사 가상대학 플랫폼 개발 이상적인 가상대학시스템의 미래상 제안 5 웹-기반 가상대학 시스템 전통적인 교수 방법 시간/공간 제약을 극복한 학습동기 부여 교수의 일방적인 내용전달 교수와 학생간의 상호작용 동료 학생들 간의 상호작용 가상대학 운영 공지사항,강의록 자료실, 메모 질의응답,

More information

Microsoft PowerPoint - 알고리즘_4주차_1차시.pptx

Microsoft PowerPoint - 알고리즘_4주차_1차시.pptx Chapter 4 Fundamental File Structure Concepts Reference: M. J. Folk and B. Zoellick, File Structures, Addison-Wesley (1992). TABLE OF CONTENTSN Field and Record Organization Record Access More about Record

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 System Software Experiment 1 Lecture 5 - Array Spring 2019 Hwansoo Han (hhan@skku.edu) Advanced Research on Compilers and Systems, ARCS LAB Sungkyunkwan University http://arcs.skku.edu/ 1 배열 (Array) 동일한타입의데이터가여러개저장되어있는저장장소

More information

API 매뉴얼

API 매뉴얼 PCI-DIO12 API Programming (Rev 1.0) Windows, Windows2000, Windows NT and Windows XP are trademarks of Microsoft. We acknowledge that the trademarks or service names of all other organizations mentioned

More information

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

Microsoft PowerPoint - chap11.ppt [호환 모드] 2010-1 학기프로그래밍입문 (1) 11 장입출력과운영체제 박종혁 Tel: 970-6702 Email: jhpark1@snut.ac.kr k 0 특징 printf() - 임의의개수의인자출력 - 간단한변환명세나형식을사용한출력제어 A Book on C, 4ed. 11-1 printf() printf(control_string, other_argument) -

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Error and Command Line Arguments Jo, Heeseung 학습목표 오류처리함수동적메모리할당명령행인자 2 오류처리함수 [1] 오류메시지출력 : perror(3) #include void perror(const char *s); [ 예제 1-4] perror 함수사용하기 01 #include 02

More information

제1장 Unix란 무엇인가?

제1장  Unix란 무엇인가? 1 소켓 2 1 소켓 클라이언트 - 서버모델 네트워크응용프로그램 클리이언트 - 서버모델을기반으로동작한다. 클라이언트 - 서버모델 하나의서버프로세스와여러개의클라이언트로구성된다. 서버는어떤자원을관리하고클라이언트를위해자원관련서비스를제공한다. 3 소켓의종류 소켓 네트워크에대한사용자수준의인터페이스를제공 소켓은양방향통신방법으로클라이언트 - 서버모델을기반으로프로세스사이의통신에매우적합하다.

More information

T100MD+

T100MD+ User s Manual 100% ) ( x b a a + 1 RX+ TX+ DTR GND TX+ RX+ DTR GND RX+ TX+ DTR GND DSR RX+ TX+ DTR GND DSR [ DCE TYPE ] [ DCE TYPE ] RS232 Format Baud 1 T100MD+

More information

Microsoft PowerPoint - IOControl [호환 모드]

Microsoft PowerPoint - IOControl [호환 모드] 목차 Input/Output Control I/O Control Mechanism mmap function munmap function RAM Area Access LED Control 4 digits 7 Segment Control Text LCD Control 1 2 I/O Control Mechanism (1) I/O Control Mechanism (2)

More information

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

À©µµ³×Æ®¿÷ÇÁ·Î±×·¡¹Ö4Àå_ÃÖÁ¾ P a 02 r t Chapter 4 TCP Chapter 5 Chapter 6 UDP Chapter 7 Chapter 8 GUI C h a p t e r 04 TCP 1 3 1 2 3 TCP TCP TCP [ 4 2] listen connect send accept recv send recv [ 4 1] PC Internet Explorer HTTP HTTP

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 - 알고리즘_1주차_2차시.pptx

Microsoft PowerPoint - 알고리즘_1주차_2차시.pptx Chapter 2 Secondary Storage and System Software References: 1. M. J. Folk and B. Zoellick, File Structures, Addison-Wesley. 목차 Disks Storage as a Hierarchy Buffer Management Flash Memory 영남대학교데이터베이스연구실

More information

설계란 무엇인가?

설계란 무엇인가? 금오공과대학교 C++ 프로그래밍 jhhwang@kumoh.ac.kr 컴퓨터공학과 황준하 16 강. 파일입출력목차 파일입출력기초 파일입출력모드 텍스트파일과이진파일 이진파일입출력 임의접근 1 /18 16 강. 파일입출력파일입출력기초 파일입출력과정 파일스트림객체생성 파일열기 사용 : 기본적으로표준입출력객체 (cin, cout) 사용방법과동일 파일닫기 파일스트림클래스의종류

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

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 프레젠테이션 Sensor Device Jo, Heeseung Sensor 실습 HBE-SM5-S4210 에는근접 / 가속도 / 컴파스센서가장착 각센서들을사용하기위한디바이스드라이버와어플리케이션을작성 2 근접 (Proximity) 센서 HBE-SM5-S4210 Camera Module 근접센서디바이스 근접센서는사물이다른사물에접촉되기이전에가까이접근하였는지를검출할목적으로사용 일반적으로생활에서자동문이나엘리베이터,

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 - 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

Microsoft PowerPoint - polling.pptx

Microsoft PowerPoint - polling.pptx 지현석 (binish@home.cnu.ac.kr) http://binish.or.kr Index 이슈화된키보드해킹 최근키보드해킹이슈의배경지식 Interrupt VS polling What is polling? Polling pseudo code Polling 을이용한키로거분석 방어기법연구 이슈화된키보드해킹 키보드해킹은연일상한가! 주식, 펀드투자의시기?! 최근키보드해킹이슈의배경지식

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

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 과제간단해설및소개 정우영조교 최종업데이트 : 2013-12-14 들어가며 이거자체는 1 번과제끝나고부터만들기시작했는데어쩌다보니배포는이제와서야 ㅜㅜ 대략적인문제만집었습니다. 프기실 에해당하는문제는가능한집지않으려합니다. 앞으로추가할거있으면하겠지만.. 이제마지막이네요ㅡㅡ ; sizeof 연산자 array, struct/union 에대해선할당받은크기 포인터에겐포인터의크기를돌려줌

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

강의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

(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 - chap02-C프로그램시작하기.pptx

Microsoft PowerPoint - chap02-C프로그램시작하기.pptx #include int main(void) { int num; printf( Please enter an integer "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); return 0; } 1 학습목표 을 작성하면서 C 프로그램의

More information

교육지원 IT시스템 선진화

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

More information

슬라이드 1

슬라이드 1 7.4 프로세스간통신 Interprocess Communication 기본적인프로세스간통신기법 데이터스트림과파이프 data stream and pipe 정보의송수신에사용되는일련의연속된데이터 a sequence of data used to send or receive information 예 : 프로세스와파일 ( 파일디스크립터을통하여 ) 을연결해주는데이터스트림

More information

제1장 Unix란 무엇인가?

제1장  Unix란 무엇인가? 7 장 C 표준파일입출력 컴퓨터과학과박환수 1 2 7.1 파일및파일포인터 시스템호출과 C 라이브러리함수 시스템호출 (System Calls) Unix 커널에서비스요청하는호출 UNIX man의 Section 2에설명되어있음 C 함수처럼호출될수있음. C 라이브러리함수 (Library Functions) C 라이브러리함수는보통시스템호출을포장해놓은함수 보통내부에서시스템호출을함

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

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

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

<4D F736F F F696E74202D2034C5D8BDBAC6AEC6C4C0CFC0D4C3E2B7C2312E505054>

<4D F736F F F696E74202D2034C5D8BDBAC6AEC6C4C0CFC0D4C3E2B7C2312E505054> 의료프로그래밍실습 의료공학과이기영 1 Chap. 11 파일입출력 2 1 이장의목표 텍스트파일의입출력방법을익힌다. (284 쪽그림참조 ) 3 C 언어의파일종류 텍스트파일 (text file) 사람들이읽을수있는문자들을저장하고있는파일 텍스트파일에서 한줄의끝 을나타내는표현은파일이읽어들여질때, C 내부의방식으로변환된다. 이진파일 (binary file) : 자료형그대로의바이트수로연속해서저장

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

Microsoft PowerPoint - chap9 [호환 모드]

Microsoft PowerPoint - chap9 [호환 모드] 제 9 장프로세스관계 숙대창병모 1 Contents 1. Logins 2. Process Groups 3. Sessions 4. Controlling Terminal 5. Job Control 숙대창병모 2 로그인 숙대창병모 3 터미널로그인 /etc/ttys: 1 line per terminal device getty: opens terminal device

More information

컴파일러

컴파일러 YACC 응용예 Desktop Calculator 7/23 Lex 입력 수식문법을위한 lex 입력 : calc.l %{ #include calc.tab.h" %} %% [0-9]+ return(number) [ \t] \n return(0) \+ return('+') \* return('*'). { printf("'%c': illegal character\n",

More information

Unix 의 역사 Bell Lab의 Ken Tompson이 PDP-7 위에서 개발 (1969년) Dennis Ritchie가 참가하여 대부분을 C언어로 작성 Sixth Edition 개발 (1976년) 다른 기관이 사용할 수 있도록 배포한 최초의 버전 이후에 UNIX는

Unix 의 역사 Bell Lab의 Ken Tompson이 PDP-7 위에서 개발 (1969년) Dennis Ritchie가 참가하여 대부분을 C언어로 작성 Sixth Edition 개발 (1976년) 다른 기관이 사용할 수 있도록 배포한 최초의 버전 이후에 UNIX는 고급 시스템 프로그래밍 (소프트웨어 개발 트랙) 제1장 소개 2004. 08. 22 1 Unix 의 역사 Bell Lab의 Ken Tompson이 PDP-7 위에서 개발 (1969년) Dennis Ritchie가 참가하여 대부분을 C언어로 작성 Sixth Edition 개발 (1976년) 다른 기관이 사용할 수 있도록 배포한 최초의 버전 이후에 UNIX는 크게

More information

bn2019_2

bn2019_2 arp -a Packet Logging/Editing Decode Buffer Capture Driver Logging: permanent storage of packets for offline analysis Decode: packets must be decoded to human readable form. Buffer: packets must temporarily

More information

CD-RW_Advanced.PDF

CD-RW_Advanced.PDF HP CD-Writer Program User Guide - - Ver. 2.0 HP CD-RW Adaptec Easy CD Creator Copier, Direct CD. HP CD-RW,. Easy CD Creator 3.5C, Direct CD 3.0., HP. HP CD-RW TEAM ( 02-3270-0803 ) < > 1. CD...3 CD...5

More information

슬라이드 1

슬라이드 1 Task 통신및동기화 : 파이프 (Pipe) Chapter #11 파이프 (Unamed Pipe) 표준입출력과파이프 FIFO(Named Pipe) 강의목차 Unix System Programming 2 파이프 (Unnamed Pipe) 파이프 (Pipe) (1) 하나의프로세스를다른프로세스에연결시켜주는단방향의통신채널 입출력채널과동기화기능을제공하는특수한형태의파일

More information

Microsoft PowerPoint - 3ÀÏ°_º¯¼ö¿Í »ó¼ö.ppt

Microsoft PowerPoint - 3ÀÏ°_º¯¼ö¿Í »ó¼ö.ppt 변수와상수 1 변수란무엇인가? 변수 : 정보 (data) 를저장하는컴퓨터내의특정위치 ( 임시저장공간 ) 메모리, register 메모리주소 101 번지 102 번지 변수의크기에따라 주로 byte 단위 메모리 2 기본적인변수형및변수의크기 변수의크기 해당컴퓨터에서는항상일정 컴퓨터마다다를수있음 short

More information

<4D F736F F F696E74202D20BBB7BBB7C7D15F FBEDFB0A3B1B3C0B05FC1A638C0CFC2F72E BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D20BBB7BBB7C7D15F FBEDFB0A3B1B3C0B05FC1A638C0CFC2F72E BC8A3C8AF20B8F0B5E55D> 뻔뻔한 AVR 프로그래밍 The Last(8 th ) Lecture 유명환 ( yoo@netplug.co.kr) INDEX 1 I 2 C 통신이야기 2 ATmega128 TWI(I 2 C) 구조분석 4 ATmega128 TWI(I 2 C) 실습 : AT24C16 1 I 2 C 통신이야기 I 2 C Inter IC Bus 어떤 IC들간에도공통적으로통할수있는 ex)

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

Computer Programming (2008 Fall)

Computer Programming  (2008 Fall) Computer Programming Practice (2011 Winter) Practice 12 Standard C Libraries The Last Practice 2012. 01. 25 2/24 Contents Standard C Libraries Input & Output Functions : stdio.h String Functions : string.h

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

11장 포인터

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

More information

ECE30076 Embedded System Programming - LED Device Driver

ECE30076 Embedded System Programming - LED Device Driver Module 12: LED 제어디바이스드라이버 ESP30076 임베디드시스템프로그래밍 (Embedded System Programming) 조윤석 전산전자공학부 주차별목표 하드웨어제어를위한디바이스드라이버작성방법알아보기 LED 제어용디바이스드라이버작성하기 ioremap 을이용한 LED 제어디바이스드라이버 mmap 을이용한 LED 제어디바이스드라이버 2 디바이스구분

More information