




下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
《unix操作系统设计》英文版习题答案1S.1
UnixInternals(April/May-2024,Set-1)JNTU-Anantapur
B.Tech.III-YearII-Sem.(JNTU-Anantapur)
CodeNo.:9A05602/R09
B.Tech.IIIYearIISemesterRegularExaminations
April/May-2024UNIXINTERNALS
(ComputerScienceandEngineering)
Time:3Hours
Max.Marks:70
AnsweranyFIVEQuestionsAllQuestionscarryequalmarks
---1.
(a)DrawandexplainthearchitectureofUNIXsystems.(Unit-I,TopicNo.1.5.1)(b)Discussindetailthesleepandwakeupprocedures.(Unit-V,TopicNo.5.6)
2.
(a)
Ifseveralprocessescontendforabuffer,thekernelguaranteesthatnoneofthemsleepforever,butitdoesnotguaranteethataprocesswillnotbestarvedoutfromuseofabuffer.Redesigngetblksothataprocessisguaranteedeventualuseofabuffer.(Unit-II,TopicNo.2.2)(b)Whataretheadvantagesofbuffercache?(Unit-II,TopicNo.2.5)
3.
(a)Givebriefdescriptionabouttheaccessingofinodes.(Unit-III,TopicNo.3.1)(b)Explainindetailthecontinuousfileallocationsystem.(Unit-III,TopicNo.3.7)
4.
(a)Whatisthepurposeoflinksystemcall?Writeandexplainthealgorithmforthesame.(Unit-IV,TopicNo.4.12)(b)Writeshortnotesonmaintenanceofthefilesystem.(Unit-IV,TopicNo.4.15)5.
(a)Whatareregions?Explaintheirroleinthecreationofprocesses.(Unit-V,TopicNo.5.2)(b)Describeindetailaboutthecontextofaprocess.(Unit-V,TopicNo.5.3)
6.
(a)Explainthesecurityproblemsthatexistsifasetuidprogramisnotwriteprotected.(Unit-VI,TopicNo.6.6)(b)Writeaprogramthataparentandchildsharesafileaccess.(Unit-VI,TopicNo.6.1)7.
(a)Discussindetailabouttheschedulingparameters.(Unit-VII,TopicNo.7.1)(b)Whatisprofiling?Explainitindetail.(Unit-VII,TopicNo.7.3)8.
(a)Explainclistsindetail.(Unit-VIII,TopicNo.8.3)
(b)
Writeaprogramforreadingdatafromriskbyusingblockandrawinterfaces.
(Unit-VIII,TopicNo.8.3)
S.2
SpectrumALL-IN-ONEJournalforEngineeringStudents,2024
B.Tech.III-YearII-Sem.(JNTU-Anantapur)
(a)
DrawandexplainthearchitectureofUNIXsystems.
Answer:April/May-12,Set-1,Q1(a)
ForanswerreferUnit-I,Q10.
(b)Discussindetailthesleepandwakeup
procedures.
Answer:April/May-12,Set-1,Q1(b)
ForanswerreferUnit-V,Q17.
(a)Ifseveralprocessescontendforabuffer,
thekernelguaranteesthatnoneofthemsleepforever,butitdoesnotguaranteethataprocesswillnotbestarvedoutfromuseofabuffer.Redesigngetblksothataprocessisguaranteedeventualuseofabuffer.
Answer:April/May-12,Set-1,Q2(a)
Algorithmgetblk
Input:filesystemnumber
blocknumber
Output:lockedbufferthatcannowbeusedforblock{
While(buffernotfound)
{
If(blockisnotinhashqueue)
If(therearenobuffersonfreelist){
sleep(eventanybufferbeesfree);continue;
}}}}
(b)Whataretheadvantagesofbuffer
cache?
Answer:April/May-12,Set-1,Q2(b)
ForanswerreferUnit-II,Q12,Topic:AdvantagesofBufferCache.
(a)Givebriefdescriptionaboutthe
accessingofinodes.
Answer:April/May-12,Set-1,Q3(a)
Accessingofinodescanbeexplainedwellthroughthealgorithmthatallocatesin-coreinodes.
(b)Explainindetailthecontinuousfileallocationsystem.
Answer:
April/May-12,Set-1,Q3(b)
Note:Ingivenquestion,thewordcontiguousismisprintedascontinous.
Inacontiguousallocationmethodallthefilesarearrangedinasequentialblocksofmemory.Therefore,accordingtothistechnique,ifafilesizeiskblocksanditstartsfromablocksthenitspanstillstk-1blocknumbers.Withthisapproachfileaccessismuchfasterasallfilesoccupycontiguousblocks.Forsequentialaccessoffilesthephysicaladdressofthelastreferredblockisnoted,sothatfileaccesscanstartfromthenextblocktoavoidrepeatedaccesseofthepreviousblocks.Directaccessisalsosupportedsinceonlythestartingaddressandtheblocknumbersarerequired.
Thoughaccesstimeisminimal,contiguousallocationdoesnotmakeefficientuseofthediskspace.Thismeansthattheallocationofspaceforanewfileshouldbeefficientenoughsothatdiskspaceisnotwasted.
0123456
7
891011IMP121314
15
16171819USER2024222324252627CHAT
2829303132
33
34
35
DISK
FOODirectory
FilenameStartinglocation
SizeFooImpUserChat
0614263764
Figure:ContiguousAllocation
S.3
UnixInternals(April/May-2024,Set-1)JNTU-Anantapur
B.Tech.III-YearII-Sem.(JNTU-Anantapur)
monstrategiesusedforthispurposesarebestfit,worstfitandfirstfit.Firstfitisconsideredtousuallybefasterthanothertwostrategies.However,bestfitisalsoconsideredtobeefficientthanworsefitintermsofbothtimeanddiskspaceutilization.
Evenifanyofthesestrategiesareusedallofthemsufferwithexternalfragmentation.Externalfragmentationoccurswhenarequestforanewfilecannotbesatisfiedbecausethelargestavailablecontinouschunkofblocksisnotsufficientenoughforthefile.Therefore,eventhoughthereisenoughspaceavailableforthefile,butitisnotutilizedbecauseitisnotcontiguous.
Externalfragmentationcanberesolvedwiththehelpofaschemecalled“paction”.Compactioninvolvesrearrangingallfreememorylocationsinasequentialordersothatcontiguousdiskspacecanbeallocatedfornewfilesinsteadofspacegettingwasted.Compactioniscarriedoutinbothofflineandonlinemodes.Inofflinemode,alloperationsaresuspendedandthefilesystemisunmountedandfinallypactionisperformed.Inthisstrategyalotoftimeiswastedandhenceitisavoided.Inonlinemode,pactionisperformedalongwithothersystemoperations,butiteffectsbusinessperformanceandreducestimewastages.
However,contiguousallocationschemealsorequirestoknowthesizeofthenewfileforstorageallocation.Thisrequirementlookssimplebutitmightbedifficulttodeterminethesizeofanoutputfileafteritsexecution.Alsoifthesizeofthefileisdeterminedinadvanceandthefiletakesalotoftimetoreachitsfinalsize,thenalotofspaceiswastedwhenthefilehasnotreacheditsfinalsize.Therefore,amodifiedcontiguousallocationschemeisusedthatallocatessomefixedamountofspaceforthefirsttimeandifthefilerequiresmorespacethenanotherchunkofcontiguousblocksisallocated.Thechunksoffreeblocksallocatedafterthefirstallocationiscalled“infant”andthesetwochunksofcontiguousblocksarelinkedtooneanother.
Q4.(a)Whatisthepurposeoflinksystemcall?
Writeandexplainthealgorithmforthesame.
Answer:April/May-12,Set-1,Q4(a)Link()SystemCall
Linksystemcallcreatesanewdirectoryforaninodethatalreadyexists.Itdoesthisbylinkingafiletoanewnameinthefilesystemdirectory.Ithasthefollowingsyntax,
Link(existingfilename,newfilename)
Thefilesystemconsistsofpathnamesforeachlink.Processesusethepathnamestoaccessfiles.AllthefilenamesaregivenequalprioritiessincetheKernelisunawareoftheoriginalfilename.
Figure:FilesLinkedintheFileSystemTreeAfterexecutingthesystemcalls
Link(“/usr/foo/sys/src”,“/usr/lib/src'');
Link(“/usr/lib/file3.h”,“/usr/Foo/src/file2h”);Thepaths–“/usr/Foo/sys/file2.h”,“/usr/lib/file3.h”and“/usr/lib/src/file2-h”belongtothesamefile.
TheKernelgivestheauthorityoflinkingdirectoriesonlytothesuperuses.Thismakesthecodingparteasyfortheprogramthattraversesthefilesystemtree.Superusershavetobecarefulenoughwhilelinkingdirectories.Theabilityoflinkingdirectoriesmustbesupportedonearlyversionsofthesystem.Thisisbecause,themkdirmandusedforcreatingnewdirectoriesdependsontheabilityoflinkingdirectories.Algorithmoflinksystemcall,thefollowingalgorithmshowsthelinkingoffiles.
1.Obtaintheinodeforexistingfilenameusingthe
“namei”algorithm.2.Iftherearemanylinksonfile/linkingdirectory
withoutsuperuserpermission.
(a)Releasetheinodeusing“iput”algorithm.(b)Returnerror.3.Incrementthelinkcount.4.Updatethediskcopyofinode.5.Unlockinode.6.Obtaintheparentforthenewfilenameinode
using“namei”algorithm.7.Ifthenewfilealreadyexists,
(a)Undotheupdatedoneinstep(4)(b)Returnerror.8.Makeanewdirectoryintheparentdirectoryof
thenewfilename.9.Addthenewfilenameandtheinodenumberof
theexistingfilename.
10.Releaseparentdirectoryinodeusing“iput”
algorithm.
11.Releasetheinodeoftheexistingfileusing“iput”
algorithm.
S.4SpectrumALL-IN-ONEJournalforEngineeringStudents,2024TheKerneluses“namei”algorithmtolookupfortheinodeforthesourcefile.Itincrementsthelinkcountandupdatesthediskcopyoftheinode.Thenitunlockstheinodeandsearchesforthetargetfile.The“Link”callwillfailifthefileisnotavailable.TheKerneldecrementsthelinkcountwhichwaspreviouslyincremented.Ifthefileisnotavailablethenitfindsafreeslotintheparentdirectoryofthetargetfile.Itwritesthenameofthetargetfileandinodenumberofthesourcefileintoit.Usingthe“iput”algorithm,itreleasestheinodeofthetargetfileparentdirectory.Thetargetfiledidnotexistinactual.Hencenomoreinodesaretheretobereleased.
Finally,theKernelreleasesthesourcefileinodewhichisaccessedbyanotherfileinthefilesystem.Thelinkcountincreasesby1.Itkeepstrackofthecountofdirectoryentriesbelongingtothefile.Thisdifferentiatesitfromtheinodereferencecount.Ifthefileisnotaccessedbyanyotherprocesstheninodereferencecountofthefilebees0andthelinkcountwillbeatleast2.
(b)Writeshortnotesonmaintenanceofthefilesystem.
Answer:April/May-12,Set-1,Q4(b)ForanswerreferUnit-IV,Q17.
Q5.(a)Whatareregions?Explaintheirroleinthecreationofprocesses.
Answer:April/May-12,Set-1,Q5(a)ForanswerreferUnit-V,Q3,Topic:Regions.
(b)Describeindetailaboutthecontextofaprocess.
Answer:April/May-12,Set-1,Q5(b)ForanswerreferUnit-V,Q7.
Q6.(a)Explainthesecurityproblemsthatexistsifasetuidprogramisnotwriteprotected.Answer:April/May-12,Set-1,Q6(a)Thesecurityproblemsthatexistsifasetuidprogramisnotwriteprotectedareasfollows,
1.Thefirstproblemisassociatedwithexecutingasequenceofmandsdefinedbytheattacker.
2.Thesecondproblemisassociatedwithsubstitutingdataoftheattacker’schoosingfordatacreatedbya
program.
Inthefirstproblem,anattackertakesadvantageofthesetuidprogram’srunningwithspecialprivilegestoforceittoexecutewhatevermandstheattackerneeds.Forinstance,assumethatanattackerfoundacopyoftheBourneshellthatwassetuidtoroot.Theattackercouldthenexecutetheshellsince,theshellissetuidtorootthesemandswouldbeexecutedasthoughroothadtypedthem.Hence,theattackercoulddoanythinghewants,sincerootisthemosthighlyprivilegeduseronthesystem.Eveniftheshellwerechangedtoreadfromamandfileratherthanacceptmandsinteractively,theattackercouldfilesimplycreatehisownscriptandruntheshellusingit.Thissituationmustbeavoidedanditiseasytoavoidbutitoccursfrequently.
Severalproblemsarepossiblewithworld-writablefiles.Occasionallyprogramswillusetemporaryfilesforvariouspurposes,thefunctionoftheprogramdependingonwhatisinthefile.Iftheprogramclosesthetemporaryfileatanypointandthenreopensitlater,anattackercanreplacethetemporaryfilewithafilewithotherdatathatwillcausetheprogramtoactastheattackerdesires.Ifthereplacementfilehasthesameownerandgroupasthetemporaryfile,itcanbeverydifficultfortheprogramtodetermineifitisbeingspoofed.
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 六、电阻教学设计初中物理北师大版北京九年级全一册-北师大版北京2013
- 高中化学 专题一 多样化的水处理技术 1.2 硬水软化与海水淡化说课稿 苏教版选修2
- 第15课 综合实践活动教学设计-2025-2026学年小学信息技术(信息科技)六年级下册电子工业版(内蒙古)
- 2024-2025学年八年级地理上册 1.2 人口和民族说课稿 (新版)粤教版
- 20 食物链说课稿-2025-2026学年小学科学五年级下册青岛版(六三制2024)
- 2025年初级建筑安全考试题库及答案
- 12.3 角的平分线的性质2024-2025学年八年级上册数学新说课稿(人教版)
- 小学信息技术第三册下 第4课 省事省力来画图-如何使用Logo重复命令 2说课稿 泰山版
- 第九章 人的食物来自环境说课稿-2025-2026学年初中生物学苏教版七年级下册-苏教版
- 人力资源咨询方案报价
- 酒店残疾人服务工作流程
- 中华民族共同体概论讲稿专家版《中华民族共同体概论》大讲堂之第三讲 文明初现与中华民族起源(史前时期)
- 公路工程技术创新管理制度
- 河北省承德市隆化县第二中学2023-2024学年九年级上学期期中考试物理试题(无答案)
- 蜗牛与黄鹂鸟(课件)人音版音乐二年级上册
- 3.1水循环课件高一地理人教版(2019)必修一+
- DB11∕1450-2017 管道燃气用户安全巡检技术规程
- JTG G10-2016 公路工程施工监理规范
- 《电力生产统计技术导则 第2部分供用电统计》
- 模板施工智能化技术应用
- 化学(基础模块)中职PPT完整全套教学课件
评论
0/150
提交评论