ﺩﺭﺱ ﺳﻴﺴﺘﻢﻫﺎﯼ ﻋﺎﻣﻞ )ﺩﻛﺘﺮ ﺟﻠﻴﻠﻲ( ﺯﻣﺴﺘﺎﻥ ۱۳۸۶ ﺗﻤﺮﻳﻦ ﮐﺎﻣﭙﻴﻮﺗﺮﯼ ۴ ﺗﺎﺭﻳﺦ ﺗﺤﻮﻳﻞ :ﺷﻨﺒﻪ ۱۳۸۶/۱۱/۶ ﻧﮑﺎﺕ ﻗﺎﺑﻞ ﺗﻮﺟﻪ .۱ﺗﻤﺮﻳﻦﻫﺎﯼ ﮐﺎﻣﭙﻴﻮﺗﺮﯼ ﺑﺎﻳﺪ ﺩﺭ ﮔﺮﻭﻩﻫﺎﯼ ﺩﻭ ﻧﻔﺮﻩ ﺍﻧﺠﺎﻡ ﺷﻮﺩ. .۲ﺑﺮﻧﺎﻣﻪﻫﺎ ﺑﺎﻳﺪ ﺩﺭ ﻣﺤﻴﻂ ﻟﻴﻨﻮﮐﺲ ﻭ ﺑﺎ ﺯﺑﺎﻥ C/C++ﻧﻮﺷﺘﻪ ﺷﻮﻧﺪ. .۳ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ Makefileﺑﺮﺍﯼ ﺳﺎﺧﺖ ﺑﺮﻧﺎﻣﻪﻫﺎ ﺍﻟﺰﺍﻣﯽ ﺍﺳﺖ .ﺍﻃﻼﻋﺎﺕ ﻣﺮﺑﻮﻁ ﺑﻪ ﻧﻮﺷﺘﻦ Makefileﺩﺭ ﺑﺨﺶ ﻣﻨﺎﺑﻊ ﻭﺏﺳﺎﻳﺖ ﺩﺭﺱ ﻣﻮﺟﻮﺩ ﺍﺳﺖ. .۴ﺗﻤﺎﺭﻳﻦ ﺑﺎﻳﺪ ﺗﺎ ﭘﺎﻳﺎﻥ ﻭﻗـﺖ ﺗﻌﻴـﻴﻦ ﺷـﺪﻩ ،ﺑـﻪ ﺁﺩﺭﺱ ce424-owner@lists.ce.sharif.eduﻓﺮﺳـﺘﺎﺩﻩ ﺷﻮﻧﺪ. ﻋﻨﻮﺍﻥ ﻣﻴﻞ CA4 : ﺫﮐﺮ ﻧﺎﻡ ﻭ ﻧﺎﻡ ﺧﺎﻧﻮﺍﺩﮔﯽ ﻭ ﺷﻤﺎﺭﻩ ﺩﺍﻧﺸﺠﻮﻳﻲ ﺩﺭ ﻣﺘﻦ ﻧﺎﻣﻪ ﺍﻟﺰﺍﻣﯽ ﺍﺳﺖ. ﻣﺘﻦ ﺑﺮﻧﺎﻣﻪ ﺑﻪ ﺻﻮﺭﺕ zipﺷﺪﻩ ﻭ ﻓﺮﻣﺖ ) (family1_family2.zipﭘﻴﻮﺳﺖ ﺷﻮﺩ. .۵ﺗﻨﻬــﺎ ﺩﺭ ﺻــﻮﺭﺕ ﺑــﺮﻭﺯ ﻣــﺸﻜﻞ ﺩﺭ ﻓﺮﺳــﺘﺎﺩﻥ ﺗﻤــﺎﺭﻳﻦ ﺑــﻪ ﺁﺩﺭﺱ ﻓــﻮﻕ ،ﻣــﻲﺗﻮﺍﻧﻴــﺪ ﺁﻥ ﺭﺍ ﺑــﻪ ﺁﺩﺭﺱ ce424s86@gmail.comﺑﻔﺮﺳﺘﻴﺪ. .۱ﺍﻟﮕﻮﺭﻳﺘﻢ Bakery ﺑﺮﻧﺎﻣﻪﺍﻱ ﺑﻨﻮﻳﺴﻴﺪ ﻛﻪ ﺍﻟﮕﻮﺭﻳﺘﻢ ) Bakeryﺑﺮﺍﻱ ﻣﺴﺄﻟﻪﻱ ﻫﻤﮕﺎﻡﺳﺎﺯﻱ ﺑﻴﺸﺘﺮ ﺍﺯ ۲ﺗﺮﺩ( ﺩﺭ ﻛﺘﺎﺏ ﺩﺭﺳﻲ ﺭﺍ ﭘﻴﺎﺩﻩﺳـﺎﺯﻱ ﻛﻨﺪ .ﺷﻤﺎ ﺑﺎﻳﺪ ﻳﻚ ﺑﺮﻧﺎﻣﻪﻱ ﭼﻨﺪﺭﺷﺘﻪﺍﻱ ) (multi-threadﺳﺎﺩﻩ ﺑﺮﺍﻱ ﺗﺴﺖ ﺑﺮﻧﺎﻣـﻪﻱ ﺍﺻـﻠﻲ ﺧـﻮﺩ ﺑﻨﻮﻳـﺴﻴﺪ .ﺑـﺮﺍﻱ ﻣﺜﺎﻝ ،ﻫﺮ ﺭﺷﺘﻪ ،ﻳﻚ ﻓﻴﻠﺪ ﻣﺸﺘﺮﻙ ﺭﺍ ﺩﺍﺧﻞ ﻳﻚ whileﺑﻲﻧﻬﺎﻳﺖ Incrementﻣﻲﻛﻨﺪ ﻭ ﺭﻭﻱ ﺻﻔﺤﻪﻱ ﻧﻤﺎﻳﺶ ﭼﺎﭖ ﻣﻲﻛﻨﺪ .ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺧﻮﺩ ﻣﺘﺪﻫﺎﻱ ﻫﻤﮕﺎﻡﺳﺎﺯﻱ C/C++ﻣﺠﺎﺯ ﻧﻤﻲﺑﺎﺷﺪ. .۲ﺍﻟﮕﻮﺭﻳﺘﻢ Bankers ﻫﺪﻑ ﺍﻳﻦ ﻗﺴﻤﺖ ،ﺷﺒﻴﻪﺳﺎﺯﻱ ﺍﻟﮕﻮﺭﻳﺘﻢ Bankersﺑﺮﺍﻱ ﻣﺴﺄﻟﻪﻱ ﺑﻦﺑﺴﺖ ﻣﻲﺑﺎﺷﺪ .ﭘـﺲ ﺍﺯ ﺍﺟـﺮﺍﻱ ﺑﺮﻧﺎﻣـﻪ ،ﺍﻃﻼﻋـﺎﺕ ﻣﻨﺎﺑﻊ ﻭ ﭘﺮﺩﺍﺯﻩﻫﺎ ﺍﺯ ﻳﻚ ﻓﺎﻳﻞ ﻭﺭﻭﺩﻱ ﺧﻮﺍﻧﺪﻩ ﻣﻲﺷﻮﺩ .ﻓﺮﻣﺖ ﻓﺎﻳﻞ ﻭﺭﻭﺩﻱ ﺑﻪ ﻫﻤﺮﺍﻩ ﻳﻚ ﻣﺜﺎﻝ ﺩﺭ ﺯﻳﺮ ﺁﻭﺭﺩﻩ ﺷﺪﻩ ﺍﺳﺖ. -١- Input File Format: ProcessesNum ResourcesTypeNum Resources: … resource1Num resource2Num resource3Num Max: Max matrix Allocated: Allocated matrix Sample Input File: 3 3 Resource: 9 9 12 Max: 5 7 10 7 3 2 3 3 3 Allocated: 3 6 9 4 1 0 1 1 2 ﺗﻮﺟﻪ ﺷﻮﺩ ﻛﻪ PIDﻫﺎ ﺍﺯ ۱ﺷﺮﻭﻉ ﻣﻲﺷﻮﻧﺪ )ﺩﺭ ﻣﺜﺎﻝ ﻓﻮﻕ۱ :ﻭ۲ﻭ.(۳ ﺩﺳﺘﻮﺭﺍﺕ ﺃ- - killﻣﻨﺎﺑﻊ ﻳﻚ ﭘﺮﺩﺍﺯﻩ ﺭﺍ ﺁﺯﺍﺩ ﻣﻲﻛﻨﺪ ﻭ ﭘﺮﺩﺍﺯﻩ ﺭﺍ ﺧﺎﺗﻤﻪ ﻣﻲﺩﻫﺪ .ﻣﺜﺎﻝ: kill: />kill processID Resources were released: R1 R2 R3 3 6 9 >/ ﺏ - req -ﺑﺎ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ،ﻫﺮ ﭘﺮﺩﺍﺯﻩ ﻣﻲﺗﻮﺍﻧﺪ ﻳﻚ ﺳﺮﻱ ﻣﻨﺎﺑﻊ ﺭﺍ ﺩﺭﺧﻮﺍﺳﺖ ﺩﻫﺪ ﻭ ﻳـﺎ ﺁﺯﺍﺩ ﻛﻨـﺪ) .ﻋﻼﻣـﺖ ﻣﺜﺒﺖ ﺑﻪ ﻣﻌﻨﺎﻱ ﺩﺭﺧﻮﺍﺳﺖ ﻭ ﻋﻼﻣﺖ ﻣﻨﻔﻲ ﺑﻪ ﻣﻌﻨﺎﻱ ﺁﺯﺍﺩ ﻛـﺮﺩﻥ ﻣﻨـﺎﺑﻊ ﺍﺳـﺖ( .ﺍﻳـﻦ ﺩﺳـﺘﻮﺭ ،ﭘـﺲ ﺍﺯ ﮔﺮﻓﺘﻦ PIDﭘﺮﺩﺍﺯﻩ ،ﺗﻌﺪﺍﺩ ﻣﻨﺎﺑﻊ ﺩﺭﺧﻮﺍﺳﺘﻲ ﻳـﺎ ﺁﺯﺍﺩﺷـﺪﻩ ﺑـﻪ ﺍﺯﺍﻱ ﺁﻥ PIDﺭﺍ ﺍﺯ ﻭﺭﻭﺩﻱ ﻣـﻲﮔﻴـﺮﺩ ﻭ ﺧﺮﻭﺟﻲﻫﺎﻱ ﻣﺨﺘﻠﻔﻲ ﻣﻤﻜﻦ ﺍﺳﺖ ﺗﻮﻟﻴﺪ ﻛﻨﺪ .ﻣﺜﺎﻝ: -٢- req: />req 2 request: 2 0 2 System has not enough resources for this request. />req 2 request: 2 0 1 This request could cause a deadlock. />req 3 request: 1 0 1 The request was accepted. />req 1 request: -2 -2 -2 The request was accepted. ﺑﺮﺍﻱ ﻧﻤﻮﻧﻪ ،ﻣﻮﺭﺩ ﺁﺧﺮ ﺑﻪ ﺍﻳﻦ ﻣﻌﻨﺎﺳﺖ ﻛﻪ ﭘﺮﺩﺍﺯﻩﻱ ۲ ،۱ﻭﺍﺣﺪ ﺍﺯ ﻫﺮ ﻣﻨﺒﻊ ﺍﺧﺘﺼﺎﺹﻳﺎﻓﺘﻪ ﺭﺍ ﺁﺯﺍﺩ ﻣﻲﻛﻨﺪ. ﺕ - safeseq -ﻳﻚ ﺣﺎﻟﺖ ﺍﻣﻦ ،ﺑﺮﺍﻱ ﺍﺟﺮﺍﻱ ﻛﺎﻣﻞ ﺗﻤﺎﻡ ﭘﺮﺩﺍﺯﻩﻫﺎ ﻧﻤﺎﻳﺶ ﻣﻲﺩﻫﺪ )ﺩﺭ ﺻﻮﺭﺕ ﻭﺟﻮﺩ(. ﺙ - showmaxneed -ﻣﺎﺗﺮﻳﺲ ﺣﺪﺍﻛﺜﺮ ﻧﻴﺎﺯ ﺭﺍ ﻧﺸﺎﻥ ﻣﻲﺩﻫﺪ. ﺝ- - showallocationﻣﺎﺗﺮﻳﺲ ﻣﻨﺎﺑﻊ ﺍﺧﺘﺼﺎﺹﻳﺎﻓﺘﻪ ﺩﺭ ﺣﺎﻝ ﺣﺎﺿﺮ ﺭﺍ ﻧﺸﺎﻥ ﻣﻲﺩﻫﺪ. ﺡ- - quitﺍﺯ ﺑﺮﻧﺎﻣﻪ ﺧﺎﺭﺝ ﻣﻲﺷﻮﺩ. -٣-
© Copyright 2025 Paperzz