- 1、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Ch4 Linux System Programming – Process IPC Jianjian SONG Software Institute, Nanjing University Oct, 2004 Content Process process environment Process Control Process identifier, fork, exec… Process relationship Signal Inter-process communication (IPC) Pipe, FIFO semaphore, shared memory, message queue Daemon Thread 1. Process Process Environment What is a process? Program and process Process: an address space with one or more threads executing within that address space, and the required system resources for those threads. (SUSv3) The startup of a process System call “fork” Process resources struct task_struct System space stack … System call “exec” The entry of C programs System stack The entry of C programs crt0.o cc/ld main function function prototype: int main(int argc, char *argv[]); The termination of a process Five ways of terminating a process Normal termination Return from “main” function Call “exit” function Call “_exit” function Abnormal termination Call “abort” function Terminated by a signal exit _exit functions Function prototype: #include stdlib.h void exit(int status); #include unistd.h void _exit(int status); Exit status Difference _exit is corresponding to a system call, while “exit” is a library function. _exit terminate a process immediately. Exit handler atexit function Register a function to be called at normal program termination. Prototype: #include stdlib.h int atexit(void (*function)(void)); on_exit function Example The memory map of a C program Text segment (code segment) Data segment Initialized data Uninitialized data Heap Stack Command line arguments main function int main(int argc, char *argv[]); Example: The implementation of echo(1) Command line option Standard usage getopt function getopt function Prototype: int getopt(int argc, char *const argv[], const char *optstring); extern char *optarg; extern int optind, opterr, optopt; Question: getopt(argc, argv, “if:lr”); Program example (P104, in BLP) Environment variables E
您可能关注的文档
最近下载
- 2025-2026学年初中体育与健康八年级全一册(2024)人教版(2024)教学设计合集.docx
- 《彩色电视机原理与检修》中职全套教学课件.pptx
- 材料工程基础讲稿30 粉末冶金概论.ppt VIP
- 2025年国防知识竞赛题库及答案(共300题).pdf
- 自考综合英语二串讲+历年真题.pdf VIP
- 2025年法考崔红玉主观民事综合案例15题笔记完整版.pdf
- 高一化学离子反应练习题.doc VIP
- 齐鲁银行总行社会招聘笔试真题2022.docx VIP
- 2023年齐鲁银行总行社会招聘考试真题(含答案).pdf VIP
- 2025齐鲁银行总行社会招聘笔试备考试题及答案解析.docx VIP
文档评论(0)