讲解:CSCI 3100、C++、c/c++、thread handlingHaskell|Haskell

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

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,864评论 0 10
  • The Inner Game of Tennis W Timothy Gallwey Jonathan Cape ...
    网事_79a3阅读 12,947评论 3 20
  • Day6 -20180913-柒彩早餐 【早餐与脂肪 】 随着生活条件的不断提升我们饮食中的“油水”比例不断提高,...
    紫水晶_a66f阅读 108评论 0 0
  • 早上十点多出车。在段李路口买了三个鸡公叫,将里面的粉丝馅吃了,就算作早午餐吧。车上还带了一个椰子和一些红薯干,饿了...
    小棕榈阅读 295评论 0 1
  • 昨晚一个人,室友进城了。安静的宿舍,放松的我。其实我想说的是我做了一个噩梦,很模糊,不记得任何细节了。只记得梦见了...
    土豆西瓜胡萝卜阅读 127评论 0 0

友情链接更多精彩内容