Professional Documents
Culture Documents
그림 1.2 Server handling multiple clients at the same time
그림 1.2 Server handling multiple clients at the same time
과목의 의의
- 네트워크 프로그램 이해, 개발
- 통신 및 관련 응용 프로토콜 이해
- C 프로그램 숙련, 고도화된 대형 프로그램 개발 능력 배양
- OS (kernel) 구현 이해
progname = argv[0];
printf(“argc = %d\n”, argc);
for (i=0; i<argc; i++) {
prt = malloc(strlen(argv[i]+1);
strcpy(ptr, argv[i]);
if (debug)
printf(“%s\n”, ptr);
}
}
Heap
Uninitialized data
Initialized read-write data
Initialized read-only data
Text (code)
kernel context
info required to keep track of the process & to stop and restart the process
CPU registers corresponding to the process, physical memory location and size of the
process, etc
Process table (process context)
Process id, etc
Environment list
main (int argc, char * argv[], char * envp[]) {
int j;
for( j=0; envp[ j]!= (char *) 0; j++)
printf(“%s\n”, envp[ j]);
exit(0);
}
Variable = string
HOME = …..
SHELL = …..
TERM = …….
USER = …..
PATH = ……
File types
Regular file (ordinary file)
Directory file (names & i-nodes)
Character special file, block special file = I/O devices
Fifo = named pipe
Symbolic link = file containing the pathname of another file
socket
call return
call return
exit( ) _exit( )
C start off routine C exit routine C _exit routine
Kernel
kernel passes argument list (and environment list) to main( ) on its initial stack
system call
- User program interface to get services from OS
- In Unix, interface implemented in the form of C function
cf) C library function vs system call
- a few hundred of system calls in Unix
- usually returns -1 if error (vs system int variable errno in <error.h>)