国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看

合肥生活安徽新聞合肥交通合肥房產(chǎn)生活服務(wù)合肥教育合肥招聘合肥旅游文化藝術(shù)合肥美食合肥地圖合肥社保合肥醫(yī)院企業(yè)服務(wù)合肥法律

System Calls程序代做、代寫(xiě)Manage Files

時(shí)間:2024-02-25  來(lái)源:合肥網(wǎng)hfw.cc  作者:hfw.cc 我要糾錯(cuò)



Assignment 1
Introduction
In Assignment 1, students will learn to use system calls.
System Calls
Manage Files
int open(const char *pathname, int flags, ...
/* mode_t mode */ );
ssize_t read(int fd, void buf[.count], size_t count);
ssize_t write(int fd, const void buf[.count], size_t count);
open()
The open() system call opens the file specified by pathname. If the specified file does not exist,
it may optionally (if O_CREAT is specified in flags) be created by open().
The return value of open() is a file descriptor, a small, nonnegative integer that is an index to an
entry in the process's table of open file descriptors. The file descriptor is used in subsequent
system calls (read(2), write(2), lseek(2), fcntl(2), etc.) to refer to the open file. The file descriptor
returned by a successful call will be the lowest-numbered file descriptor not currently open for
the process.
read()
read() attempts to read up to count bytes from file descriptor fd into the buffer starting at buf.
On files that support seeking, the read operation commences at the file offset, and the file offset
is incremented by the number of bytes read. If the file offset is at or past the end of file, no bytes
are read, and read() returns zero.
If count is zero, read() may detect the errors described below. In the absence of any errors, or if
read() does not check for errors, a read() with a count of 0 returns zero and has no other effects.
write()
write() writes up to count bytes from the buffer starting at buf to the file referred to by the file
descriptor fd.
The number of bytes written may be less than count if, for example, there is insufficient space on
the underlying physical medium, or the RLIMIT_FSIZE resource limit is encountered
(seesetrlimit(2)), or the call was interrupted by a signal handler after having written less than
count bytes. (See also pipe(7).)
For a seekable file (i.e., one to which lseek(2) may be applied, for example, a regular file) writing
takes place at the file offset, and the file offset is incremented by the number of bytes actually
written. If the file was open(2)ed with O_APPEND, the file offset is first set to the end of the file
before writing.
The adjustment of the file offset and the write operation are performed as an atomic step.
Map files
mmap() creates a new mapping in the virtual address space of the calling process. The starting
address for the new mapping is specified in addr. The length argument specifies the length of
the mapping (which must be greater than 0).
For more details, see mmap(2) - Linux manual page
void *mmap(void addr[.length], size_t length, int prot, int flags,int fd, off_t
offset);
int munmap(void addr[.length], size_t length);
Process
pid_t fork(void);
pid_t wait(int *_Nullable wstatus);
pid_t waitpid(pid_t pid, int *_Nullable wstatus, int options);
int waitid(idtype_t idtype, id_t id, siginfo_t *infop, int options);
fork()
fork() creates a new process by duplicating the calling process.
The new process is referred to as the child process. The calling process is referred to as the
parent process.
The child process and the parent process run in separate memory spaces. At the time of fork()
both memory spaces have the same content.
Memory writes, file mappings (mmap(2)), and unmappings
(munmap(2)) performed by one of the processes do not affect the other.
The child process is an exact duplicate of the parent process except for the following points:
• The child has its own unique process ID, and this PID does not match the ID of any existing
process group (setpgid(2)) or session.
• The child's parent process ID is the same as the parent's process ID.
• The child does not inherit its parent's memory locks (mlock(2), mlockall(2)).
For more details, see fork(2) - Linux manual page
wait()
All of these system calls are used to wait for state changes in a child of the calling process, and
obtain information about the child whose state has changed. A state change is considered to be:
the child terminated; the child was stopped by a signal; or the child was resumed by a signal. In
the case of a terminated child, performing a wait allows the system to release the resources
associated with the child; if a wait is not performed, then the terminated child remains in a
"zombie" state (see NOTES below).
If a child has already changed state, then these calls return immediately. Otherwise, they block
until either a child changes state or a signal handler interrupts the call (assuming that system
calls are not automatically restarted using the SA_RESTART flag of sigaction(2)). In the
remainder of this page, a child whose state has changed and which has not yet been waited
upon by one of these system calls is termed waitable.
Graph Preleminary
Graph Layout
OA : Offset Array.
NA : Neighbor Array.
In our implementation, the graph is in CSR format. Which means that, if you want to know the
neighbor of node i , get OA[i] and OA[i+1] , the index range of NA that stores
neighbors.
In the graph.size file, it has 8 bytes, which are the number of nodes and number of edges.
( |nodes| , |edges| )
In the graph file, the first |nodes|+1 *4 Bytes are values of OA . The following |edges| *4
Bytes are values of NA . The last |edges| *4 Bytes are values of edge weight for
corresponding edge.
Dataset Download
You can get dataset, and sample output of Assignment 1 from the following link:
CSC3150_2**4Term2_A1_data - OneDrive
Your dataset should be placed at the same directory of code
main@ubuntu:~/Desktop$ ls
a.out grader g1 g1.size g2 g2.size graph.cpp graph.h sample_output
Important
In this assignment, all datasets to read and output files you need to write are in binary format.
Please take a look at std::ios::binary .
sample_output is used for self-checking if the answers to task1 are correct.
Task1
In task1, you are provided with data sets graph1 , graph2 correspondings to Task1_1
and Task1_2 . In such graphs, the nodes can be represented as cities, edges between cities
can be represented as roads. We provide a program traversing nodes through BFS algorithm.
Figure: Transportation Graph
• Your first task is to complete the remaining part of program so that it can correctly load data
into memory and do BFS traverse execution.
• After BFS traversal is done, the program needs to store the sequence of visits to the result file.
• In the following progress charts, blocks in yellow means it's a file, in red means it's a TODO
part for you.
• In this task, you need to complete Task1_1(), Task1_2() . In Task1_2() we only
have 2GB memory but g2 has 1.8GB data. Traditional read from disk to memory does not
work.
Hint
• When loading the graph, please note that OA has length |nodes|+1 instead of
|nodes| . This is because we miantain one more integer for some boundary problems.
What you read from the .size file is |nodes| and |edges| .
Task2
In task 2, the program goes into a simple simulation. In the daytime, a node gains weights from
its edges with corresponding edge weights, implemented by produce() . In the night, a
node's weight will self-increased by 1, implemented by consume() .
The global view of process is shown in the figure below. We highlight the components you needs
to do in green and yellow blocks:
You are required to use fork() to handle two processes. For the parent process, we will do
calculation of produce() . For the child process, we will do consume() . Both of these
functions are provided, you do not need to do any modification to it.
// Executed in parent process
void produce(int *weights, int len, Graph &g) {
for (int i=0; i<len; i++) {
int l,r;
g.get_edge_index(i,l,r);
for (int j=l;j<r;j++) {
weights[i+1]+=g.edge_weights[j];
}
}
}
// Executed in child process
void consume(int *weights, int len, Graph &g) {
for (int i=0; i<len; i++) {
weights[i+1] += 1;
}
}
TODO
• Your task is to complete the following functions with correct system call and control logic so
that program runs correctly as shown in the above figrue.
• In implementation of communication, it actually shares the data stored in weights
◦ Format of array weights : the first integer should be the value of current iteration (start
from 0). The following |V| integers are corresponding weights of vertex
• For each iteration generated by child process, child process should write result to file
e.g. For 4th and 5th iterations, write sequence of nodes weight to
/home/csc3150/A1/Task2_parent.output_2 and
/home/csc3150/A1/Task2_child.output_2 .
• Program terminates at 10th iteration
// Task2: Process Inter-Communicationvoid Task2() {
Graph g;
int fd;
fd = g.map_global_graph("g2");
std::string ipc_path("ipc_file");
// Creating inter process communication file if there is not.
int ipc_fd = open(ipc_path.c_str(),O_RDWR| O_CREAT,0777);
lseek (ipc_fd, (g.v_cnt+1)*sizeof(int)-1, SEEK_SET);
write (ipc_fd, "", 1);
close(ipc_fd);
std::string output_parent_path("Task2_parent.output");
std::string output_child_path("Task2_child.output");
// process control
}
// Task2: Process Inter-Communication with control
void parent_process(const std::string &path) {
int pid = getpid();
printf("parent proc %d is producing\n",pid);
// produce()
return;
}
// Task2: Process Inter-Communication with control
void child_process(const std::string &path) {
int pid = getpid();
printf("child proc %d is consuming\n",pid);
// consume()
return;
}
Hint
• The status of vertices need to be communicated inter-process at each iteration because both
processes need to process/ fetch data.
• You might need to define index 0 of mapped file in mmap() as control int
◦ Because of Data Dependency, execution order matters
◦ By reading control byte, each process will know whether they should wait, process, or
terminate.
• You can use mmap() to share reading the data graph if both processes need information of
graph.
◦ Try to figure out how memory is consumed when multi-process using mmap map to one
file.
Output files
You are expected to generate the following files when you complete all the tasks
All these files are in the same directory as graph.h, graph.c
(wrong file name will not be correctly graded):
Report 10'
You shall strictly follow the provided latex template for the report, where we have emphasized
important parts and respective grading details. Reports based on other templates will not be
graded.
Report Template
• You can find latex template in the following link
◦ https://www.overleaf.com/read/ybgnjwnyvjpx#dd17ed
• We also provide template at BB.
LaTex Editor
For your convenience, you might use Overleaf, an online LaTex Editor.
1. Create a new blank project.
2. Click the following highlight bottom and upload the template we provide.
3. Click Recompile and you will see your report in PDF format.
Extra Credit
Instead of using shared memory space for inter-process communication, you are required to
implement Task2 with using message passing.
Using any profiling tools to compare performance of communication via shared memory
(mmap) and message passing.
Report your result and your discovery.
Hint
• You can use pipe() to pass updated messages from parent process to child process/ or from
child process to parent process.
• You can learn to use dtrace for profiling in this task.
Execution
main@ubuntu:~/Desktop$ g++ graph.cpp
main@ubuntu:~/Desktop$ ./a.out
Submission
• Due on: 23:59, 28 Feb 2023
• Plagiarism is strictly forbidden. Please note that TAs may ask you to explain the meaning of
your program to ensure that the codes are indeed written by yourself. Please also note that
we would check whether your program is too similar to your fellow students' code and
solutions available on the internet using plagiarism detectors.
• Late submission: A late submission within 15 minutes will not induce any penalty on your
grades. But 00:16 am-1:00 am: Reduced by 10%; 1:01 am-2:00 am: Reduced by 20%; 2:01
am-3:00 am: Reduced by 30% and so on. (e.g., Li Hua submitted a perfect attempt at 2:10
a.m. He will get (100+10 (bonus))*0.7=77p
• Any incorrect execution results by the following reasons are not arguable (Please double
check before submit)
◦ Compile error (Ensure no modification on header file)
◦ Incorrect file name/ path (Please strictly follow naming and path provided in instruction
and template)
◦ Successfully running program with incorrect result
Format guide
The project structure is illustrated below. You can also use ls command to check if your
structure is fine. Structure mismatch would cause grade deduction.
For this assignment, you don't need a specific folder for the bonus part. The source folder
should contain four files: graph.c, report.pdf . Please note that graph.h is not need to submit.
We limit your implementation within graph.c file, starting with "Task:" comments.
main@ubuntu:~/Desktop/Assignment_3_120010001$ ls
report.pdf graph.c
(One directory and one pdf.)
Please compress all files in the file structure root folder into a single zip file and name it using
your student ID as the code shown below and above, for example,
Assignment_3_120010001.zip. The report should be submitted in the format of pdf, together
with your source code. Format mismatch would cause grade deduction. Here is the sample step
for compressing your code.
main@ubuntu:~/Desktop$
zip -q -r Assignment_1_120010001.zip Assignment_3_120010001
main@ubuntu:~/Desktop$ ls
Assignment_1_120010001 Assignment_1_120010001.zip
Grading Rules
Program part **'
You can test the correctness of your output using the following commands under directory.
• Execution with argument 0 will simply return grade
• Execution with argument 1 will return the test result of each case (1 for correct, 0 for wrong).
main@ubuntu:~/Desktop$ ./grader 1
請(qǐng)加QQ:99515681  郵箱:99515681@qq.com   WX:codehelp 

掃一掃在手機(jī)打開(kāi)當(dāng)前頁(yè)
  • 上一篇:FTEC5530代做、代寫(xiě)MATLAB設(shè)計(jì)程序
  • 下一篇:代寫(xiě)MET CS777 Large-Scale Text Processing
  • 無(wú)相關(guān)信息
    合肥生活資訊

    合肥圖文信息
    流體仿真外包多少錢_專業(yè)CFD分析代做_友商科技CAE仿真
    流體仿真外包多少錢_專業(yè)CFD分析代做_友商科
    CAE仿真分析代做公司 CFD流體仿真服務(wù) 管路流場(chǎng)仿真外包
    CAE仿真分析代做公司 CFD流體仿真服務(wù) 管路
    流體CFD仿真分析_代做咨詢服務(wù)_Fluent 仿真技術(shù)服務(wù)
    流體CFD仿真分析_代做咨詢服務(wù)_Fluent 仿真
    結(jié)構(gòu)仿真分析服務(wù)_CAE代做咨詢外包_剛強(qiáng)度疲勞振動(dòng)
    結(jié)構(gòu)仿真分析服務(wù)_CAE代做咨詢外包_剛強(qiáng)度疲
    流體cfd仿真分析服務(wù) 7類仿真分析代做服務(wù)40個(gè)行業(yè)
    流體cfd仿真分析服務(wù) 7類仿真分析代做服務(wù)4
    超全面的拼多多電商運(yùn)營(yíng)技巧,多多開(kāi)團(tuán)助手,多多出評(píng)軟件徽y1698861
    超全面的拼多多電商運(yùn)營(yíng)技巧,多多開(kāi)團(tuán)助手
    CAE有限元仿真分析團(tuán)隊(duì),2026仿真代做咨詢服務(wù)平臺(tái)
    CAE有限元仿真分析團(tuán)隊(duì),2026仿真代做咨詢服
    釘釘簽到打卡位置修改神器,2026怎么修改定位在范圍內(nèi)
    釘釘簽到打卡位置修改神器,2026怎么修改定
  • 短信驗(yàn)證碼 豆包網(wǎng)頁(yè)版入口 破天一劍 目錄網(wǎng) 排行網(wǎng)

    關(guān)于我們 | 打賞支持 | 廣告服務(wù) | 聯(lián)系我們 | 網(wǎng)站地圖 | 免責(zé)聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網(wǎng) 版權(quán)所有
    ICP備06013414號(hào)-3 公安備 42010502001045

    国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看
    欧美激情视频在线观看| 国产二区不卡| 欧美精品在线观看| 国产精品美女诱惑| 精品国产一区二区三区久久狼5月| 99精品人妻少妇一区二区| 国产伦精品一区二区三毛| 国内自拍欧美激情| 欧美综合激情网| 国产综合精品一区二区三区| 久久96国产精品久久99软件| 精品国产一区二区三区麻豆免费观看完整版 | 日日摸夜夜添一区| 久久综合九色综合网站| 日韩在线一区二区三区免费视频| 久久精品国产成人精品| 国产精品美女www| 宅男av一区二区三区| 日韩精品免费播放| 欧美二区三区| 国产午夜大地久久| 黄色录像特级片| 91精品在线播放| xxxx性欧美| 久久国产精品99国产精| 亚洲三区视频| 精品日本一区二区三区| 97成人在线视频| 国产精品丝袜高跟| 日韩一级片播放| 美女一区视频| 久久精品视频网站| 亚洲狠狠婷婷综合久久久| 国产欧美日韩综合一区在线观看| 97精品国产91久久久久久| 国产精品视频中文字幕91| 懂色av一区二区三区在线播放| 免费看成人午夜电影| 久久国产亚洲精品无码| 亚洲一区二区三区精品视频| 欧美在线视频一二三| 久久久久久国产免费| 中文字幕中文字幕在线中心一区 | 色中文字幕在线观看| 欧美与黑人午夜性猛交久久久 | 国产日产欧美一区二区| 97精品伊人久久久大香线蕉| 久久久久久久免费| 亚洲乱码一区二区三区三上悠亚| 国产欧美日韩视频| 久久五月天综合| 国产主播在线一区| 国产精品视频最多的网站| 欧美在线日韩精品| 久久久国产视频91| 狠狠97人人婷婷五月| 色琪琪综合男人的天堂aⅴ视频| 亚洲一区影院| 成人在线观看毛片| 亚洲成人第一| 国产v综合v亚洲欧美久久| 午夜精品一区二区三区在线观看 | 国产伦精品一区二区三区四区视频 | 国严精品久久久久久亚洲影视 | 亚洲综合在线播放| 国产偷久久久精品专区| 国产av第一区| 91精品国产乱码久久久久久久久| 亚洲av首页在线| 久久婷婷开心| 欧美日韩亚洲综合一区二区三区激情在线| 北条麻妃一区二区三区中文字幕| 黄色网络在线观看| 欧美激情一区二区三级高清视频| 91免费版网站入口| 欧美亚洲一区在线| 一区二区三区我不卡| 国产精品99久久久久久久久久久久| 欧美视频在线观看网站| 欧美巨猛xxxx猛交黑人97人| 久久久久久艹| 精品1区2区| 亚洲精品在线视频观看| 国产精品美女免费| 超碰在线观看97| 痴汉一区二区三区| 国产精品日韩一区二区三区| 国产精品一区二区三区免费| 人人妻人人做人人爽| 亚洲日本精品一区| 国产精品成人观看视频免费| 久久婷婷五月综合色国产香蕉| 欧美一区二区影视| 亚洲蜜桃在线| 国产精品美女呻吟| 日韩在线播放av| 91久久久久久国产精品| 欧美视频观看一区| 亚洲成熟丰满熟妇高潮xxxxx| 国产精品二区在线| 国产成a人亚洲精v品在线观看| 国产精品午夜视频| 国产综合色一区二区三区| 日韩美女免费视频| 无码中文字幕色专区| 亚洲va男人天堂| 精品国产免费av| 久久国产欧美精品| aaa级精品久久久国产片| 国产欧美日本在线| 国产午夜伦鲁鲁| 国产午夜精品一区| 狠狠97人人婷婷五月| 日韩av免费一区| 亚洲精品电影在线一区| 中文字幕一区二区三区四区五区人| 精品久久久久久乱码天堂| 国产精品成人免费视频| 久久久国产视频| 毛片精品免费在线观看| 欧美乱人伦中文字幕在线| 亚洲欧洲免费无码| 日本久久高清视频| 日本精品免费| 欧美 日韩 亚洲 一区| 天堂资源在线亚洲视频| 国语自产精品视频在线看| 国产欧美日韩综合一区在线观看| 国产美女精品视频免费观看| 成人国产精品一区二区| 69久久夜色精品国产69乱青草| 97成人在线视频| 国产成人精品在线| 国产精品第10页| 日本高清久久天堂| 国产伦精品一区二区三区照片91| 久久久久久国产精品美女| 亚洲色婷婷久久精品av蜜桃| 色综合久综合久久综合久鬼88| 川上优av一区二区线观看| 性色av一区二区三区| 欧美中日韩一区二区三区| 国产私拍一区| 久久综合狠狠综合久久综青草| 国产精品丝袜白浆摸在线| 天堂√在线观看一区二区| 极品美女扒开粉嫩小泬| 久久久久久国产精品mv| 蜜月aⅴ免费一区二区三区 | 亚洲影视中文字幕| 亚洲一区二区三区乱码aⅴ蜜桃女 亚洲一区二区三区毛片 | 97免费中文视频在线观看| 日韩中文字幕亚洲| 亚洲一区二区三区sesese| 欧美精品七区| 日韩中文字幕在线视频| 午夜精品在线视频| 国产在线观看精品| 久久久久五月天| 亚州精品天堂中文字幕| 超碰在线97av| 国产精品久久久久久久久久| 欧洲黄色一级视频| 九色91视频| 欧美有码在线观看| y97精品国产97久久久久久| 日韩免费黄色av| 久久精品成人动漫| 国语自产精品视频在线看| 久久久91精品国产| 日本精品免费在线观看| 99色精品视频| 精品自在线视频| 蜜桃视频成人| 国产精品日韩在线观看| 青青在线视频观看| 久久99精品久久久久子伦| 色狠狠久久av五月综合| 国产高清在线一区二区| 色欲av无码一区二区人妻| 91久久中文字幕| 青青青国产在线视频| www.日本久久久久com.| 精品婷婷色一区二区三区蜜桃| 久久不射电影网| 久久久中文字幕| 国产欧美日韩精品在线观看| 亚洲最大福利网| 久久久久久久影院| 精品视频免费在线播放| 中文字幕在线中文| 97精品视频在线| 日韩精品一区二区三区色欲av| 国产精品视频免费观看www| 97碰在线视频| 日韩美女免费观看| 色综合导航网站| 国产高清自拍99| 国产一区二区视频在线观看| 亚洲国产精品一区二区第四页av |