c线程代业代写代调试posixthreads代编码

rrrrrrrrr rrrrrrrrr     2022-11-07     744

关键词:

C线程代业代写代调试、POSIX Threads代编码
(CSCI 363) Project Two -- POSIX Threads
Instructions
This program sorts strings using "enzymes". An enzyme is a function that sorts two consecutive
characters. We define one enzyme per pair of consecutive characters; these enzymes working
together in parallel can sort the entire string. We use pthreads to instantiate and parallelize the
enzymes.
Unfortunately, this program doesn‘t seem to be working correctly. That‘s where you come in.
Before you edit the code, read through it, and answer these questions:
1) Briefly explain why this application would be difficult to write using multiple processes
instead of threads.
2) What is the significance of ‘workperformed‘? How is it used?
3) Explain exactly what is the type of ‘fp‘ in the following declaration: void *(*fp)(void *)
Now, to fix the program:
1) The function run_enzyme() needs to be created. Please see the notes inside enzyme.c.
2) The function ‘make_enzyme_threads‘ has a memory bug. Fix this by simply re-ordering the
lines in this function. It is simple fix but may take a while for you to find it.
3) The function ‘join_on_enzymes‘ is incomplete. Read the relevant man pages and figure out
how the function is supposed to work. Then insert the correct code snippets into
‘whatgoeshere‘.
4) Your programming work can be considered complete when you have completed the above
and all of the tests pass.
Testing
make test
./enzyme -test -f0 all
Running tests...
1.make ::pass
2.sort ::pass
3.pleasequit1 ::pass
4.pleasequit0 ::pass
5.swap1 ::pass
6.swap2 ::pass
7.swap3 ::pass
8.run_enzyme ::pass
9.join ::pass
10.cancel ::pass
You may also want to experiment with the cancel function -
./enzyme Cba
./enzyme CBA
Questions
1) Why do we not detach any of the enzyme threads? Would the program function if we
detached the sleeper thread?
2) Why does the program use sched_yield? What happens if this is not used? Will the swap
counts always be identical?
3) Threads are cancelled if the string contains a ‘C‘ e.g. "Cherub". Why do we not include
cancelled threads when adding up the total number of swaps?
4) What happens when a thread tries to join itself? (You may need to create a test program to
try this) Does it deadlock? Or does it generate an error?
5) Briefly explain how the sleeper thread is implemented.
6) Briefly explain why PTHREAD_CANCEL_ASYNCHRONOUS is used in this MP.
7) Briefly explain the bug in #2 of fix the program section above.
Turn In
Enzyme.c (i.e. finish fix the program section tasks) and YourName.docx (i.e. answer the
questions above). Due date will be announced on Blackboard.
http://www.daixie0.com/contents/13/1306.html

 

我们的方向领域:window编程 数值算法 AI人工智能 金融统计 计量分析 大数据 网络编程 WEB编程 通讯编程 游戏编程多媒体linux 外挂编程 程序API图像处理 嵌入式/单片机 数据库编程 控制台 进程与线程 网络安全  汇编语言 硬件编程 软件设计 工程标准规等。其中代写代做编程语言或工具包括但不限于以下范围:

C/C++/C#代写

Java代写

IT代写

Python代写

辅导编程作业

Matlab代写

Haskell代写

Processing代写

Linux环境搭建

Rust代写

Data Structure Assginment 数据结构代写

MIPS代写

Machine Learning 作业 代写

Oracle/SQL/PostgreSQL/Pig 数据库代写/代做/辅导

Web开发、网站开发、网站作业

ASP.NET网站开发

Finance Insurace Statistics统计、回归、迭代

Prolog代写

Computer Computational method代做

 

因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:[email protected]

微信:codinghelp

boardgame作业代写代写boardgame程序c程序代写

boardgame作业代写、代写boardgame程序、C程序代写WatchYourBack!isafast-pacedcombatboardgame.Youcontrolateamofruthlessroguesengagedinafighttothedeathagainstyourenemies.Withintheconfinesofacheckerboardthereisnorulebook 查看详情

r留学生作业代码代写代编程代编程代编程

R留学生作业代码代写、代编程Math117SampleExamThreePAGEONEInProblems(1)-(13)pleasechooseasmanyoptionsasappropriate,fromamongstthefollowingprobabilitydistributions:(A)Binomial(B)Hypergeometric(C)ContinuousUniform(D)N 查看详情

spssstata编程作业代写代写rcode

spss、stata编程作业代写、代写RCode?INSTRUCTIONS:–Thisassignmentisworth15%ofyouroverallmarksforthiscourse(forallstudents,enrolledinSTAT2008,STAT4038orSTAT6038).–Ifyouwish,youmayworktogetherwithanotherstudent(one 查看详情

代做c单片机程序代写c单片机程序单片机c程序作业代写代做

描述:是要做一个和单片机交互的程序,程序能够将inputparameter发送到单片机上,然后从单片机收到处理后的数据也就是数据data,然后进行画图。目前不考虑单片机的传输工作,纯粹从程序的角度出发,也就是假定给定的数据dat... 查看详情

matlab代写代写matlabmatlab编程代写代写matlab编程test_tdpc_encoder

disp(‘===================================================================‘);disp(‘Test1‘);radix=2;rows=0;columns=4;message_vector=[0110];tryencoded_vector=TDPC_encoder(message_vector,radix,rows,column 查看详情

spss统计作业代写统计学spss代写spss编程代写代写spss作业

spss统计作业代写、统计学spss代写、spss编程代写、代写spss作业DataandModelsProjectDirections:Forthefollowingfunctions,determinethelineofbestfit.Useyourcalculatorandlookatthescatterplottohelpyouguesswhattypeoffunctionwouldbet 查看详情

r作业代写代编代码thinkingandreasoning

R作业代写代编代码ThinkingandReasoningMAST90044ThinkingandReasoningwithDataInstructions?AssignmentsaretobeplacedintheappropriatesubjectandlabboxlocatedjustinsidethenorthentrancetothePeterHallBuilding.Assignmen 查看详情

留学生r经管统计作业代写代做stat/me代写

留学生R经管统计作业代写代做、Stat/ME代写RequirementsforStat/ME424ClassProject?Thisisanindividualproject.Youcannotjoinforceswithanyoneelseintheclass,but(ifyouwish)youcancollaboratewithsomeoneinyourlaborresearchteam.?T 查看详情

网络爬虫作业代码代写代实现代做爬虫程序

网络爬虫作业代码代写代实现、代做爬虫程序任务二、网络爬虫实现一、任务描述编写大学排名爬虫程序,从“最好大学网”获取“软科中国最好大学排名”2016、2017、2018年的国内大学排名数据,并将它们输出出来。2016年中国... 查看详情

数据结构数据库设计代写代做

数据结构数据库设计代写代做关键词:【描述重要的系统设计中的词汇】引言1. 设计目的【填写你所设计的信息系统的设计目的,例如为解决什么问题,现实中什么样的困难,而设计该系统。】2. 设计背景【展开说明现实的困难... 查看详情

rlinearmodeling代写代写留学生r统计专业作业

Rlinearmodeling代写、代写留学生R统计专业作业TermProject-Part1MATH3560H-WesleyBurrProblemsYourtermprojectisintendedtobeasummaryofallofthepracticalskillswithregressionandmodelingyou’vegainedacrossthesemester.Thegoali 查看详情

rlinearmodeling代写代写留学生r统计专业作业

TermProject-Part1MATH3560H-WesleyBurrProblemsYourtermprojectisintendedtobeasummaryofallofthepracticalskillswithregressionandmodelingyou’vegainedacrossthesemester.Thegoalistopickadatasetwhichisofintere 查看详情

rlinearmodeling代写代写留学生r统计专业作业

TermProject-Part1MATH3560H-WesleyBurrProblemsYourtermprojectisintendedtobeasummaryofallofthepracticalskillswithregressionandmodelingyou’vegainedacrossthesemester.Thegoalistopickadatasetwhichisofintere 查看详情

代写二叉查找树程序作业代写bst作业代写datastructures

代写二叉查找树程序作业、代写BST作业、代写DataStructuresKIT205DataStructuresandAlgorithmsAssignment1:DataStructuresDue:27thApril,11:55pmIntroductionYouworkforaneducationcompanythatdevelopsandrunsMassiveOpenOnlineCourses( 查看详情

代写程序作业代写《大学计算机》课程报告作业

代写程序作业、代写《大学计算机》课程报告作业12345A.(答案全面、准确,概念清楚,语言精炼流畅,文字通顺,观点有新意)B.(答案较全面,概念较清楚,文字通顺)C.(答案基本完整,概念基本清楚)D.(答案欠完整... 查看详情

代写matlab编程作作代写engineeringmodeling

代写Matlab编程作作、代写EngineeringModelingEGR102:IntroductiontoEngineeringModeling(Spring2018)EGR102TermProject–FlintWaterCrisisBackground–TheFlintwatercrisisisareal-worldexampleofthechallengestoengineeringmo 查看详情

代写程序作业代写《大学计算机》课程报告作业

 12345A.(答案全面、准确,概念清楚,语言精炼流畅,文字通顺,观点有新意)B.(答案较全面,概念较清楚,文字通顺)C.(答案基本完整,概念基本清楚)D.(答案欠完整,有些概念不够清楚,达到最低要求)E.(不... 查看详情

代写r实验代写r编程数据healthdata

代写R实验、代写R编程数据、HealthDataFinalReport–WorldBankHealthDataSmallGroupEffort-200pointsInstructions:Thefinalreportisaprofessionalteamreportoncountry-levelfertilityratesandfactorsthatinfluencefertilityrates. 查看详情