Your name:S number: Homework 3CSCI 3100 Unix and CNovember 4, 20191 Process and thread handling.How to submit?(a) Zip your source codes and a screenshot (cellphone pictures are OK) for each programmingproblem. Make sure to name your file in the format of ”problem1.c” and ”screenshot1.jpg”.(b) Submit the zip file to Blackboard.Forking is very useful for applications with multiple simultaneous connections. For example,modern internet browser like Google Chrome, it creates processes for independent websites,plugins, etc. In this assignment, you will write a program to simulate how it works.1.1 Create a program for internet browser simulation. Requirement:1. It has a loop to receive user’s input.2. User can either input an URL of a website, a PID or message “exit”.3. If the input is an URL, use the fork function to create another process.(a) fork();(b) For parent process, prints a message “Create a process PID for new website”.Replace PID to the PID that you get from the fork() function.(c) For child process, prints a message “You are visiting website URL”. Replace URLto the actual URL you pass to the child process.(d) For the child process, after printing that message, create an infinite loop to prevenCSCI 3100代做、C++程序语言调试、c/c++代做、tthe child process from exiting until it receives a signal from the parent asking itto exit.4. If the input is a PID, send a SIGQUIT signal to the child process and ask it to quit.You can use the following function to check if the input can be converted to integer:1 i n t isNumber ( ch a r s [ ] , i n t s i z e )2 {3 f o r ( i n t i = 0 ; i 4 i f ( i s d i g i t ( s [ i ] ) == f a l s e )5 r e t u r n 0 ;67 r e t u r n 1 ;8 }91Your name:S number: Homework 3CSCI 3100 Unix and CNovember 4, 2019If the function return 1, then use function atoi() to convert it into integer.5. If the input is “exit”, quit your program.Here is an example output:Figure 1: Sample output1.2 Create a thread of function “mythread()” in your programand wait until it finishes. Requirements:1. Before creating the thread, print a message “A thread is going to be created.” in themain thread.2. In the function “mythread()”, print messages “Counting...” 10 times.3. After executing the thread, print message “Done executing thread.” in the main thread.1.3 Bonus 20 pts. If you can submit Makefile to compile the problemsabove with “make”, you will get 10 pts for each problem.2转自:http://www.6daixie.com/contents/13/4479.html
讲解:CSCI 3100、C++、c/c++、thread handlingHaskell|Haskell
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- The Inner Game of Tennis W Timothy Gallwey Jonathan Cape ...