日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

CSE 3100 Systems Programming

發布時間:2023/11/27 生活经验 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 CSE 3100 Systems Programming 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

代做CSE 3100留學生作業、代寫C/C++程序作業、代做Systems Programming作業、代寫C/C++編程設計作業
CSE 3100 Systems Programming
Homework #5 Due: 10/23/2018
Complete your work in the hw5 folder. Remember to pull, add, commit, and push. You need to work on
three files only: execmd.c, workon.c, and runpipeline.c. Do NOT add other files.
Exercise 1. (100 points) runpipeline
A pipeline is a sequence of external programs chained together to perform a task. The standard output of
stage i of the pipeline is fed to the standard input of stage i + 1. In shells like bash, stages are separated
by "|". For example, the following pipeline that contains 7 stages counts the number of occurrences of each
word in a text file.1 The output of the last stage is redirected into file counts.txt. whitman.txt is in the
solutions repo under sol-hw5. You can also replace it with other text files, for example, your C source code.
cat whitman.txt | tr -s [:space:] '\n' | tr -d [:punct:] | tr A-Z a-z | sort | uniq -c | \
sort -nr > counts.txt
The seven stages do the following. The command in each stage prints its result to stdout and the output
of the last command is redirected to counts.txt.
1. Send the contents of the file whitman.txt to stdout
2. Replace every sequence of consecutive spaces in stdin with a single line-feed
3. Delete all punctuation characters from stdin and send remaining characters to stdout
4. Replace uppercase letters in stdin with lowercase letters
5. Sort the lines from stdin alphabetically
6. Collapse adjacent matching lines to a single copy preceded by the number of copies
7. Sort the lines from stdin in reverse numerical order
In this problem, you will compete the functions in runpipeline.c so the program can start a pipeline
with the programs specified at the command line. To avoid interference with the shell, pipeline stages are
separated with "--", instead of "|". To run the above bash pipeline with runpipeline, you would run the
following command in bash and the resulting counts.txt should be the same. Join two lines when you try
the command.
./runpipeline cat whitman.txt -- tr -s [:space:] '\n' -- tr -d [:punct:] -- tr A-Z a-z -- \
sort -- uniq -c -- sort -nr > counts.txt
In runpipeline.c, the commands for all stages are already stored in an array of Program structures,
which are defined as follows.
1 typedef struct program_tag {
2 char ** args ; // array of pointers to arguments
3 int num_args ; // number of arguments
4 int pid ; // process ID of this program
5 int fd_in ; // pipe fd for stdin
6 int fd_out ; // pipe fd for stdout
7 } Program ;
1The “\” at the end of first line allows the pipeline commands to continue on the next line; you can also just join the two
lines when you try the pipeline in bash.
1
args[0] is the command and args is the array of arguments to be passed to an execv* function. num args
is the number of arguments in args. pid is the process ID of the child process for this command. If fd in
is non-negative, the file descriptor will be used for stdin for the command. If fd out is non-negative, it will
be used for stdout for the command.
Note that runpipeline does not redirect the input or output for the pipeline itself. If needed, the
redirection can be set on runpipeline by the shell. Then the first command in the pipeline can have
redirected stdin and the last one can have redirected stdout.
Your program will start commands in start program(), one command at a time. You can create pipes
in the function for the command to be started, if any pipe needed has not been created yet, or you can create
all pipes for all stages in function prepare pipes().
Your code should close unused pipe FDs for/in each process, should not leave zombies behind, and should
not have memory leaks.
You can use lsof command to check the open files for processes. For example,
# list open files by PIDs
$lsof -p 3753,3754,3755,3756,3757
$lsof -p 3753
# list open files for processes whose name starts with runp, cat, wc, or tr
lsof -c runp -c cat -c wc -c tr
# use -u option to specify a user name. -a indicates combine conditions with 'and'
lsof -c runp -u netid -a
The rows that you should pay attention to are the ones that have a number in the FD column. Most of
the commands have only three open files 0, 1, and 2. Some commands, for example, tee, may have additional
open files.
Dealing with many pipeline stages may look scary at the beginning. However, if you start with two stages,
and go on to three stages, four stages, and more, you will find out that seven stages are about the same as
three stages. You can test pipelines with various numbers of stages, as shown in the examples below. Note
that you can use tee to examine the data stream at the middle stages. To check if your code is producing
correct result or behaves correctly, run the same pipeline in bash (and use "|", instead of "--", to connect
stages).
./runpipeline echo 'Hello, world!'
./runpipeline echo 'Hello, world!' -- wc
./runpipeline echo 'Hello, world!' -- cat -- wc
./runpipeline echo 'Hello, world!' -- cat -- cat -- wc
./runpipeline ls -- cat -- tee t.out -- wc
./runpipeline cat -- cat -- tee t.out -- cat -- wc
http://www.6daixie.com/contents/13/2035.html

?

因為專業,所以值得信賴。如有需要,請加QQ99515681 或郵箱:99515681@qq.com?

微信:codinghelp

轉載于:https://www.cnblogs.com/PYTHON26/p/9862787.html

總結

以上是生活随笔為你收集整理的CSE 3100 Systems Programming的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 日本免费在线视频观看 | 欧美日韩视频免费观看 | 手机天堂网 | 日韩视频一二三区 | 日韩一区二区三区四区在线 | 欧美日韩激情一区 | 午夜黄色| 日韩精品免费视频 | 老色批影视 | 亚洲av无码不卡 | 欧美精品一区二区在线播放 | 日日爱网站 | 99草在线视频 | 中文幕无线码中文字蜜桃 | 免费激情视频网站 | 我要看一级片 | 国产精品女同 | 97热久久| 久久精品偷拍视频 | julia一区二区三区在线观看 | 久久av一区二区 | 国产毛片自拍 | 韩国女主播一区 | 成人午夜高清 | 亚洲欧美在线不卡 | 日韩高清黄色 | 人人妻人人玩人人澡人人爽 | 国产亚洲精品美女久久久 | 日本亚洲免费 | 爱情岛论坛永久入口 | 亚洲热av | 亚洲av久久久噜噜噜噜 | 国产毛片网 | 伊人影院综合在线 | www.午夜av| 97色伦影院 | 在线观看成人av | 干干干日日日 | 亚洲一区电影在线观看 | 久久在线免费观看 | 国产第8页 | 岛国二区三区 | 欧美熟妇精品一区二区蜜桃视频 | 久久视奸 | 日韩精品福利 | av免播放器在线观看 | 天天综合网天天综合 | 亚洲免费av在线 | 日本黄色三级视频 | 久久日本精品字幕区二区 | 国产成人在线网站 | 一区二区啪啪啪 | 亚洲91在线 | 天天看毛片 | 清纯唯美亚洲综合 | 光溜溜视频素材大全美女 | 91中文字幕在线 | 日韩激情在线观看 | 少妇一级淫片aaaaaaa | 日本成人不卡 | 国产精品自产拍 | 免费看国产黄色片 | 91麻豆精品国产 | 人妻久久一区二区三区 | 中文字字幕码一二三区 | 18被视频免费观看视频 | 欧美三级网站 | 中文字幕成人 | 中文字幕高清在线免费播放 | 青青草自拍偷拍 | 欧美1234区 | 亚洲少妇视频 | 深夜福利免费在线观看 | 亚洲成人播放 | 中国女人内精69xxxxxx | 色婷五月 | 伊人精品| 一级特黄肉体裸片 | 鲍鱼av在线 | sm捆绑调教视频 | 亚洲av综合色区无码另类小说 | 在线观看日韩一区二区 | 金鱼妻日剧免费观看完整版全集 | 亚洲2022国产成人精品无码区 | 可以在线观看av的网站 | 日韩欧美在线播放 | 国产精品456 | 中文不卡在线 | www.蜜臀 | 无码人妻丰满熟妇精品 | 国产91av在线播放 | 日本在线观看a | 四虎免费看黄 | 产乳奶汁h文1v1 | 在线色综合 | 黄色电影在线视频 | 少妇一级淫片日本 | 色欲av无码精品一区 | 欧美爱爱爱 |