99爱在线视频这里只有精品_窝窝午夜看片成人精品_日韩精品久久久毛片一区二区_亚洲一区二区久久

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

CS-350代寫、C++編程語言代做
CS-350代寫、C++編程語言代做

時間:2024-12-09  來源:合肥網(wǎng)hfw.cc  作者:hfw.cc 我要糾錯



CS-350 - Fundamentals of Computing Systems
Homework Assignment #8 - BUILD
Due on November 14, 2024 — Late deadline: November 16, 2024 EoD at 11:59 pm
Prof. Renato Mancuso
Renato Mancuso
1CS-350 - Fundamentals of Computing Systems::Homework Assignment #8 - BUILD Problem 1
BUILD Problem 1
We now have a server capable of performing non-trivial operations on images! All we have to do now is to
make the server multi-threaded. And yes, we already have the infrastructure to spawn multiple threads. So
what’s missing exactly?
Output File: server_mimg.c
Overview. As mentioned above, the main idea is to allow multple workers to perform operations on images
in parallel. Everything you have developed in BUILD 6 will be reused, but we must make sure that when
multiple worker threads are spawned, the correctness of the operations on the images is still guaranteed.
But what could be jeopardizing the correctness of these operations? Let us consider a concrete case. Imaging
the following sequence of requests queued at the server: (1) Retrieve image A, (2) blur image A, (3) detect
the vertical edges of image A, and (4) send back the result of the operations performed on image A.
With only one worker, the operations are carried out in this sequence and the result sent back to the client is
an image with the cumulative operations (2) and (3) correctly applied to the source image. With 2 workers
(unless we ffx our implementation) we could have worker #1 and #2 working in parallel on operations (1)
and (2) with the result of the operations being some weird mix of the two operations.
In this assignment, the goal is to allow safe multi-threading where the semantics of sequential operations on
the images is preserved even if multiple threads are spawned and operate in parallel. For this task, we will
use semaphores to perform inter-thread synchronization.
Design. One of the main problem that we have to solve is un-arbitrated access to shared data structures.
To verify that there is a problem unless we insert synchronization primitives accordingly, start with your (or
my) solution for HW6, rename it appropriately, and enable spawning more than 1 worker threads.
Then, run the following simple experiment. First, run the client to generate the sequence of operations listed
above with 1 worker thread and look carefully at the output report generated by the client:
./server_mimg -q 100 -w 1 2222 & ./client -I images/ -L 1:R:1:0,0:b:1:0,0:v:1:0,0:T:1:0 2222
You will notice that the ffrst hash reported by the client (9f3363f0249c15163d52e60fd9544c31) is simply
the hash of the original test1.bmp image. The second (and last) hash reported by the client is the hash
(00e4fc4b9c7c71ee2ca3946053f78793) of the blur+vertical edge detection operations applied in sequence
to the image. However, if we increase the number of worker to 2, the ffnal hash will be different! For instance,
when running:
./server_mimg -q 100 -w 2 2222 & ./client -I images/ -L 1:R:1:0,0:b:1:0,0:v:1:0,0:T:1:0 2222
The last hash obtained on the reference machine changes to b59**c2bcb0a64121def911286c706e2, but
might be something else entirely on a different machine. Also in some cases, the server crashes entirely.
To solve the problem, the cleanest way is to introduce semaphore-based synchronization between threads.
In order to deffne a semaphore, you should use the type sem_t deffned in semaphore.h. Before a semaphore
can be used, it must be initialized.
This can be done with the sem_init(sem_t * semaphore, int pshared, unsigned int init_value).
Here, semaphore is pointer to the semaphore to be initialized, pshared can be set to 0, and init_value is
a non-negative initialization value of the semaphore, following the semantics we have covered in class.
Once your semaphore has been correctly initialized (make sure to check for the error value of the sem_init(...)
call!), the wait and signal operations can be performed over it, following the semantics we have discussed
Problem 1 continued on next page. . . 2CS-350 - Fundamentals of Computing Systems::Homework Assignment #8 - BUILD Problem 1 (continued)
in class. To wait on a semaphore, you must use the sem_wait(sem_t * semaphore) call; to signal on a
semaphore, you must use the sem_post(sem_t * semaphore).
Shared Data Structures. Of course, the main question is what data structures must be protected?. Here
is a list of things that can be problematic, but your own implementation could be different, so try to map
the statement below to your own code.
(1) Image Objects: One obvious place to start is to protect the image objects that are registered with
the server and upon which operations are requested by the client. We want to prevent different worker
to simultaneously change the content of an image, so a good idea is to introduce one semaphore per each
registered image! These must be created and/or initialized dynamically at image registration time.
(2) Image Registration Array: Another shared data structure is the global array of registered images.
Concurrent operations over that array is not a good idea, so all the threads will need to synchronize when
trying to access that shared data structure.
(3) Connection Socket: What? The connection socket has always been shared, so why is that a problem
now? The truth is that it has always been a problem, but we did not care because the responses from
the workers to the client were always a one-shot send(...) operation. But now, there are cases where the
server follows a two-step approach in the protocol it follows with the client. For instance, when handling an
IMG_RETRIEVE operation, a worker ffrst provides a positive acknowledgment of completed request and then
the payload of the image being retrieved. What if another worker starts sending other data while a retrieve
operation is in progress? Careful: the same goes for the parent when handling IMG_REGISTER operations.
(4) Request Queue and STDOUT Console: We already know that the shared request queue and the
shared STDOUT console require the use of semaphores to ensure correctness. Perhaps take inspiration from
the use of semaphores in those cases to handle the other shared data structures listed above.
Desired Output. The expected server output is pretty much what you already constructed in HW6. Here
is it summarized again for reference. You should print queue status dumps, rejection and completion notices.
Queue status dumps and rejection notice are identical in format to HW5 and HW6. Once again, the queue
dump status is printed when any of the worker threads completes processing of any of the requests.
Just like HW6, when a request successfully completes service, the thread ID of the worker thread that has
completed the request will need to be added at the beginning of the line following the format below. You can
assign thread ID = (number of workers + 1) to the parent thread. If multiple worker threads are available to
process a pending request, any one of them (but only at most one!) can begin processing the next request.
T<thread ID> R<req. ID>:<sent ts>,<img_op>,<overwrite>,<client img_id>,<server img_id>,<receipt ts>,
<start ts>,<compl. ts>
Here, <img_op> is a string representing the requested operation over an image. For instance, if the operation
was IMG_REGISTER, then the server should output the string “IMG REGISTER” (no quotes) for this ffeld.
<overwrite> should just be 0 or 1, depending on what the client requested. <client img_id> should be
the image ID for which the client has requested an operation. If the server is ignoring any of these values
in the response, set these ffelds to 0. Finally, <server img_id> should report the image ID on which the
server has performed the operation requested by the client. Recall that this might be different from what
sent by the client if overwrite = 0 in the client’s request, but it must be the same if overwrite = 1.
Additional Help. You might have noticed, from the commands recommended above, that the client (v4.2)
now allows you to deffne a script of image operation requests. This is useful to test the correctness of your
server under a controlled workload.
To use this feature, you should still provide the path to the folder containing the test images using the
-I <path to images folder> parameter. Next, you should also provide the -L <images request script>
parameter, where the <images request script> is a comma-separated list of image operations with the
following format:
Problem 1 continued on next page. . . 3CS-350 - Fundamentals of Computing Systems::Homework Assignment #8 - BUILD Problem 1 (continued)
<time to next operation>:<opcode char>:<overwrite>:<image ID>.
Here, <time to next operation> is a number of seconds that will elapse between this and the next operation
 in the script.
Next, <opcode char> is a single case-sensitive (!!) letter that identiffes which operation to be performed
(see list below).
• R: IMG_REGISTER
• r: IMG_ROT**CLKW
• b: IMG_BLUR
• s: IMG_SHARPEN
• v: IMG_VERTEDGES
• h: IMG_HORIZEDGES
• T: IMG_RETRIEVE
The <overwrite> ffeld should always be set to 1 (for simplicity we do not handle cases with overwrite = 0).
Finally, the <image ID> should be the ID on which the operation should be performed. This ffeld has a
special meaning in the case of IMG_REGISTER operations. Only in this case, it tells the client which one of
the ffles scanned in the images folder should be registered with the server. In all the other cases, an ID = n
tells the client to request the operation on the n
th
image that it has registered with the server.
When a script is requested at the client, the client will conveniently report how it has understood the script.
For instance, when using the script:
1:R:1:2,2:b:1:0,0:T:1:0
the client will report:
[#CLIENT#] INFO: Reading BMP 0: test1.bmp | HASH = 9f3363f0249c15163d52e60fd9544c31
[#CLIENT#] INFO: Reading BMP 1: test2.bmp | HASH = b6770726558da9722136ce84f12bfac8
[#CLIENT#] INFO: Reading BMP 2: test3.bmp | HASH = f2ac174**6fb2be614e8ab1ae10e82f0
[#CLIENT#] INFO: Reading BMP 3: test4.bmp | HASH = 0caaef67aee1775ffca8eda02bd85f25
[#CLIENT#] INFO: Reading BMP 4: test5.bmp | HASH = 5597b44eaee51bd81292d711c86a3380
[#CLIENT#] INFO: Reading BMP 5: test6.bmp | HASH = 11552ac97535bd4433891b63ed1dd45d
[#CLIENT#] Next Req.: +1.000000000 - OP = IMG_REGISTER, OW = 1, ID = 0
[#CLIENT#] Next Req.: +2.000000000 - OP = IMG_BLUR, OW = 1, ID = 0
[#CLIENT#] Next Req.: +0.000000000 - OP = IMG_RETRIEVE, OW = 1, ID = 0
4CS-350 - Fundamentals of Computing Systems::Homework Assignment #8 - BUILD Problem 2
Submission Instructions: in order to submit the code produced as part of the solution for this homework
assignment, please follow the instructions below.
You should submit your solution in the form of C source code. To submit your code, place all the .c
and .h ffles inside a compressed folder named hw8.zip. Make sure they compile and run correctly according
 to the provided instructions. The ffrst round of grading will be done by running your code.
Use CodeBuddy to submit the entire hw8.zip archive at https://cs-people.bu.edu/rmancuso/courses/
cs350-fa24/codebuddy.php?hw=hw8. You can submit your homework multiple times until the deadline.
Only your most recently updated version will be graded. You will be given instructions on Piazza on how
to interpret the feedback on the correctness of your code before the deadline.


請加QQ:99515681  郵箱:99515681@qq.com   WX:codinghelp


 

掃一掃在手機打開當前頁
  • 上一篇:CSE2425代寫、C++編程語言代做
  • 下一篇:代寫XJEL1703、MATLAB設計編程代做
  • 無相關信息
    合肥生活資訊

    合肥圖文信息
    急尋熱仿真分析?代做熱仿真服務+熱設計優(yōu)化
    急尋熱仿真分析?代做熱仿真服務+熱設計優(yōu)化
    出評 開團工具
    出評 開團工具
    挖掘機濾芯提升發(fā)動機性能
    挖掘機濾芯提升發(fā)動機性能
    海信羅馬假日洗衣機亮相AWE  復古美學與現(xiàn)代科技完美結(jié)合
    海信羅馬假日洗衣機亮相AWE 復古美學與現(xiàn)代
    合肥機場巴士4號線
    合肥機場巴士4號線
    合肥機場巴士3號線
    合肥機場巴士3號線
    合肥機場巴士2號線
    合肥機場巴士2號線
    合肥機場巴士1號線
    合肥機場巴士1號線
  • 短信驗證碼 豆包 幣安下載 AI生圖 目錄網(wǎng)

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

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

    99爱在线视频这里只有精品_窝窝午夜看片成人精品_日韩精品久久久毛片一区二区_亚洲一区二区久久

          9000px;">

                日韩女优av电影| 久久免费午夜影院| 国产精品热久久久久夜色精品三区| 国产成人免费在线视频| 国产精品久久久久永久免费观看| 欧美性猛片aaaaaaa做受| 日韩电影免费在线观看网站| 久久久久久久久久久久久夜| 一本到不卡免费一区二区| 人人狠狠综合久久亚洲| 国产精品免费网站在线观看| 欧美精品一卡二卡| 粉嫩一区二区三区在线看| 性感美女久久精品| 国产婷婷色一区二区三区在线| 欧美主播一区二区三区| 国产成人精品午夜视频免费| 午夜精品一区在线观看| 国产色婷婷亚洲99精品小说| 欧美日韩综合在线免费观看| 岛国一区二区在线观看| 另类调教123区| 亚洲大片一区二区三区| 国产精品三级视频| 久久综合久久久久88| 欧美浪妇xxxx高跟鞋交| 91美女在线看| 国产.欧美.日韩| 久久激五月天综合精品| 亚洲风情在线资源站| 国产精品―色哟哟| 久久色中文字幕| 日韩欧美中文字幕公布| 在线看日本不卡| av在线免费不卡| 国产91精品在线观看| 国产专区欧美精品| 久久国产精品99久久久久久老狼| 成人综合日日夜夜| 欧美日韩mp4| 国产精品午夜春色av| 日韩综合小视频| 成人黄色av电影| 欧美一区二区视频免费观看| 国产日韩精品一区二区浪潮av| 亚洲黄色小说网站| 国产一区二区三区久久久 | 不卡的看片网站| 欧美一区永久视频免费观看| 国产欧美日韩综合| 青青草精品视频| 91福利视频网站| 精品国产污网站| 色综合久久99| 欧洲精品中文字幕| 欧美日韩高清一区二区| 欧美系列亚洲系列| 欧美美女网站色| 69成人精品免费视频| 这里只有精品电影| 日韩欧美色综合| 精品国产一区二区三区av性色 | 国内成人免费视频| 久久av资源站| 国产成人精品影院| 91在线观看污| 欧美日韩你懂得| 日韩午夜电影在线观看| 2024国产精品| 一区二区中文视频| 亚洲图片自拍偷拍| 美国毛片一区二区三区| 激情文学综合丁香| 高清不卡一二三区| 色哟哟国产精品免费观看| 欧美日韩在线播放一区| 欧美电影免费观看完整版| 国产亚洲1区2区3区| 中文字幕日本乱码精品影院| 亚洲综合一区在线| 麻豆精品国产91久久久久久| 国产一区美女在线| 91丨porny丨在线| 欧美精品高清视频| 久久精品在线免费观看| 日韩一区欧美一区| 五月婷婷综合网| 国内精品久久久久影院薰衣草| 福利电影一区二区三区| 精品久久久久久无| 国产拍欧美日韩视频二区| 亚洲品质自拍视频网站| 免费成人在线播放| 99re视频精品| 日韩一级高清毛片| 日韩一区欧美小说| 麻豆精品国产传媒mv男同| 91在线视频在线| 欧美va亚洲va国产综合| 亚洲男人都懂的| 激情成人综合网| 91激情在线视频| 国产免费观看久久| 日本免费在线视频不卡一不卡二| 国产69精品久久久久毛片 | 麻豆精品在线看| 99久久国产综合精品色伊| 欧美一区2区视频在线观看| 国产喷白浆一区二区三区| 亚洲v中文字幕| 成人av网址在线| 精品欧美乱码久久久久久| 亚洲激情中文1区| 国产成人丝袜美腿| 欧美一区二区三区在线电影| 亚洲视频小说图片| 国产精品99久久久久久似苏梦涵 | 精品国产一区二区三区不卡| 日韩毛片视频在线看| 激情综合色综合久久综合| 欧美视频你懂的| ●精品国产综合乱码久久久久| 久久91精品国产91久久小草| 蜜臀久久99精品久久久画质超高清| 国产黄色精品网站| 亚洲国产精品久久一线不卡| 国产欧美视频在线观看| 日韩一区二区三区视频| 972aa.com艺术欧美| 精品一区二区三区在线播放视频| 亚洲啪啪综合av一区二区三区| 日韩女优电影在线观看| 91久久精品一区二区三区| 国产一区欧美二区| 日韩激情一区二区| 亚洲激情网站免费观看| 国产日韩精品一区二区三区| 狠狠色丁香婷婷综合久久片| 这里只有精品电影| 日韩成人免费看| 欧美精品1区2区| 五月天中文字幕一区二区| 欧美日本一区二区在线观看| 午夜电影一区二区| 欧美日本在线观看| 亚洲五码中文字幕| 欧美日韩性生活| 中文字幕乱码久久午夜不卡| 精品国产一区二区三区久久影院| 在线播放亚洲一区| 欧美日韩国产一级| 91久久精品一区二区二区| av在线这里只有精品| 波多野结衣在线aⅴ中文字幕不卡| 精品一区二区影视| 久久国产精品一区二区| 久久av中文字幕片| 久久激情五月婷婷| 久久99这里只有精品| 另类小说一区二区三区| 理论电影国产精品| 国产在线一区观看| 国产不卡视频一区| 国产精品一区二区男女羞羞无遮挡 | 韩国理伦片一区二区三区在线播放| 亚洲国产精品久久人人爱蜜臀| 亚洲一区中文日韩| 丝袜亚洲精品中文字幕一区| 日韩电影在线观看电影| 麻豆精品一区二区av白丝在线 | 国产91精品一区二区麻豆亚洲| 国产精品99久久久| 成人精品免费看| 91亚洲国产成人精品一区二三| 91蜜桃婷婷狠狠久久综合9色| 色视频一区二区| 欧美区一区二区三区| 欧美一区二区视频免费观看| 精品国产人成亚洲区| 中文字幕国产一区二区| 亚洲精品免费播放| 喷白浆一区二区| 成人午夜av影视| 欧美主播一区二区三区美女| 91精品国产综合久久久久| 精品国产三级a在线观看| 日本一二三不卡| 亚洲一区二区三区自拍| 久久超碰97人人做人人爱| 丁香婷婷综合五月| 色婷婷av一区二区三区大白胸| 欧美日韩dvd在线观看| 91精品欧美久久久久久动漫| 丝袜脚交一区二区| 中文字幕巨乱亚洲| 欧美另类变人与禽xxxxx| 国产成人在线视频播放| 亚洲成人自拍网| 亚洲国产高清aⅴ视频| 欧美日本在线一区|