SlideShare a Scribd company logo
1 of 3
Download to read offline
Need help with this assignment. Please continue the code in C programming language. My current
code is below. You are supposed to build upon this code. Instructions are under the pics of the
code:
Tasksv. Write decision making logic based on the value of the looping variable (i.e. algorithm) 1.
When algorithm is equal to FIRST, call function firstFit, passing arguments blockSize, blocks,
processSize, and processes 2. When algorithm is equal to BEST, call function bestFit, passing
arguments blockSize, blocks, processSize, and processes 3. When algorithm is equal to WORST,
call function worstFit, passing arguments blockSize, blocks, processSize, and processes 4. When
algorithm is equal to NEXT, call function nextFit, passing arguments blockSize, blocks,
processSize, and processesWrite function nextFit to do the following a. Return type void b.
Parameter list includes i. One-dimensional array, data type integer, contains the block sizes (i.e.
blockSize) ii. Parameter contains the number of blocks, data type integer (i.e. blocks) iii. One-
dimensional array, data type integer, contains the process sizes (i.e. processSize) iv. Parameter
contains the number of processes, data type integer (i.e. processes) c. Declare a one-dimensional
array, data type integer, to store the block id that a process is allocated to (i.e. allocation), size is
parameter processes d. Declare a variable, data type integer, to store the block allocation for a
process, initialize to 0 (i.e. id) e. Call function memset, passing arguments i. Array allocation ii. -1
(i.e. INVALID) iii. sizeof(allocation) f. Using a looping construct, loop through the number of
processes i. Using a looping construct, loop while id is less than the number of blocks 1. If the
current block size (i.e. index id) is greater than or equal to the current process size (i.e. index of
outer looping variable) a. Update the allocation array to set the element at index of the outer
looping variable equal to variable id b. Reduce available memory of the current block size (i.e.
index id) by the processsize (i.e. index of the outer looping variable) c. break out of the inner loop
ii. Update the value of variable id to set the next index in array blockSize by adding 1 to variable id
then modulus the total by the number of blocks g. Call function displayProcess passing arguments
allocation, processes, and processSizeWrite function firstFit to do the following a. Return type void
b. Parameter list includes i. One-dimensional array, data type integer, contains the block sizes (i.e.
blockSize) ii. Parameter contains the number of blocks, data type integer (i.e. blocks) iii. One-
dimensional array, data type integer, contains the process sizes (i.e. processSize) iv. Parameter
contains the number of processes, data type integer (i.e. processes) c. Declare a one-dimensional
array, data type integer, to store the block id that a process is allocated to (i.e. allocation), size is
parameter processes d. Call function memset, passing arguments i. Array allocation ii. -1 (i.e.
INVALID) iii. sizeof(allocation) e. Using a looping construct, loop through the number of processes
i. Using a looping construct, loop the number of blocks 1. If the current block size (i.e. index of the
inner looping variable ) is greater than or equal to the current process size (i.e. index of outer
looping variable) a. Update the allocation array to set the element at index of the outer looping
variable equal to the inner looping variable b. Reduce available memory of the current block size
(i.e. index of the inner looping variable) by the process size (i.e. index of the outer looping
variable) c. break out of the inner loop f. Call function displayProcess passing arguments
allocation, processes, and processSizeWrite function bestFit to do the following a. Return type
void b. Parameter list includes i. One-dimensional array, data type integer, contains the block
sizes (i.e. blockSize) ii. Parameter contains the number of blocks, data type integer (i.e. blocks) iii.
One-dimensional array, data type integer, contains the process sizes (i.e. processSize) iv.
Parameter contains the number of processes, data type integer (i.e. processes) c. Declare a one-
dimensional array, data type integer, to store the block id that a process is allocated to (i.e.
allocation), size is parameter processes d. Call function memset, passing arguments i. Array
allocation ii. -1 (i.e. INVALID) iii. sizeof(allocation) e. Using a looping construct, loop through the
number of processes i. Declare a variable, data type integer, to store the current best fit value (i.e.
bestIdx) initialized to -1 (i.e. INVALID) ii. Using a looping construct, loop the number of blocks 1. If
the current block size (i.e. index of the inner looping variable ) is greater than or equal to the
current process size (i.e. index of outer looping variable) a. If the value of bestIdx is equal to -1
(i.e. INVALID) i. Set variable bestIdx equal to the current block (i.e. the inner looping variable) b.
Else if the value of the block size at index bestIdx is greater than the value of the block size at
index of the inner looping variable i. Set variable bestidx equal to the current block (i.e. the inner
looping variable) iii. If the value of variable bestIdx is not equal to -1 (i.e. INVALID) 1. Update the
allocation array to set the element at index of the outer looping variable equal to variable bestIdx2.
Reduce available memory of the current block size (i.e. index bestIdx) by the process size (i.e.
index of the outer looping variable) f. Call function displayProcess passing arguments allocation,
processes, and processSizeWrite function worstFit to do the following a. Return type void b.
Parameter list includes i. One-dimensional array, data type integer, contains the block sizes (i.e.
blockSize) ii. Parameter contains the number of blocks, data type integer (i.e. blocks) iii. One-
dimensional array, data type integer, contains the process sizes (i.e. processSize) iv. Parameter
contains the number of processes, data type integer (i.e. processes) c. Declare a one-dimensional
array, data type integer, to store the block id that a process is allocated to (i.e. allocation), size is
parameter processes d. Call function memset, passing arguments i. Array allocation ii. -1 (i.e.
INVALID) iii. sizeof(allocation) e. Using a looping construct, loop through the number of processes
i. Declare a variable, data type integer, to store the current worst fit value (i.e. wstIdx) initialized to
-1 (i.e. INVALID) ii. Using a looping construct, loop the number of blocks 1. If the current block size
(i.e. index of the inner looping variable ) is greater than or equal to the current process size (i.e.
index of outer looping variable) a. If the value of wstIdx is equal to -1 (i.e. INVALID) i. Set variable
wstIdx equal to the current block (i.e. the inner looping variable) b. Else if the value of the block
size at index wstIdx is less than the value of the block size at index of the inner looping variable i.
Set variable wstIdx equal to the current block (i.e. the inner looping variable)iii. If the value of
variable wstIdx is not equal to -1 (i.e. INVALID) 1. Update the allocation array to set the element at
index of the outer looping variable equal to variable wstIdx 2. Reduce available memory of the
current block size (i.e. index wstIdx) by the process size (i.e. index of the outer looping variable) f.
Call function displayProcess passing arguments allocation, processes, and processSize Write
function displayProcess to do the following a. Return type void b. Parameter list includes i. One-
dimensional array, data type integer, that stores the block number allocations (i.e. allocation) ii.
Parameter that contains the number of processes, data type integer (i.e. processes) iii. One-
dimensional array, data type integer, that stores the processes (i.e. processSize) c. Write a
looping construct to loop through the processes (i.e. processSize) i. Display to the console the
process number (i.e use the looping variable plus 1 ) ii. Display to the console the process size
(i.e. processSize array at the current looping index) iii. Display to the console the memory block
assigned based on the following logic 1. If the value stored at the current index of array
processSize if -1 (i.e. INVALID), output Not Allocated 2. Else, output the current allocation (i.e.
allocation)Select the OS program to run, enter the number of your selection. 1. Memory
Management 2. File Management 3. Multithreading 0 . ExitFigure 2 memoryManagement function
outputFigure 3 nextFit function output ********** First Fit ********** Figure 4 firstFit function
outputFigure 5 bestFit function outputFigure 6 worstFit function output

More Related Content

Similar to Need help with this assignment Please continue the code in .pdf

01-Introduction of DSA-1.pptx
01-Introduction of DSA-1.pptx01-Introduction of DSA-1.pptx
01-Introduction of DSA-1.pptxDwijBaxi
 
Introduction to System verilog
Introduction to System verilog Introduction to System verilog
Introduction to System verilog Pushpa Yakkala
 
procedures and arrays
procedures and arraysprocedures and arrays
procedures and arraysDivyaR219113
 
Ashish garg research paper 660_CamReady
Ashish garg research paper 660_CamReadyAshish garg research paper 660_CamReady
Ashish garg research paper 660_CamReadyAshish Garg
 
Programming in C sesion 2
Programming in C sesion 2Programming in C sesion 2
Programming in C sesion 2Prerna Sharma
 
Extending High-Utility Pattern Mining with Facets and Advanced Utility Functi...
Extending High-Utility Pattern Mining with Facets and Advanced Utility Functi...Extending High-Utility Pattern Mining with Facets and Advanced Utility Functi...
Extending High-Utility Pattern Mining with Facets and Advanced Utility Functi...Francesco Cauteruccio
 
Educational Objectives After successfully completing this assignmen.pdf
Educational Objectives After successfully completing this assignmen.pdfEducational Objectives After successfully completing this assignmen.pdf
Educational Objectives After successfully completing this assignmen.pdfrajeshjangid1865
 
Standard Template Library
Standard Template LibraryStandard Template Library
Standard Template LibraryGauravPatil318
 
13. Query Processing in DBMS
13. Query Processing in DBMS13. Query Processing in DBMS
13. Query Processing in DBMSkoolkampus
 
Redo midterm
Redo midtermRedo midterm
Redo midtermIIUM
 
An Answer Set Programming based framework for High-Utility Pattern Mining ext...
An Answer Set Programming based framework for High-Utility Pattern Mining ext...An Answer Set Programming based framework for High-Utility Pattern Mining ext...
An Answer Set Programming based framework for High-Utility Pattern Mining ext...Francesco Cauteruccio
 
Vizwik Coding Manual
Vizwik Coding ManualVizwik Coding Manual
Vizwik Coding ManualVizwik
 
DS-UNIT 1 FINAL (2).pptx
DS-UNIT 1 FINAL (2).pptxDS-UNIT 1 FINAL (2).pptx
DS-UNIT 1 FINAL (2).pptxprakashvs7
 
Data Structures_Introduction
Data Structures_IntroductionData Structures_Introduction
Data Structures_IntroductionThenmozhiK5
 
Clustering_Algorithm_DR
Clustering_Algorithm_DRClustering_Algorithm_DR
Clustering_Algorithm_DRNguyen Tran
 
0-Slot18-19-20-ContiguousStorage.pdf
0-Slot18-19-20-ContiguousStorage.pdf0-Slot18-19-20-ContiguousStorage.pdf
0-Slot18-19-20-ContiguousStorage.pdfssusere19c741
 

Similar to Need help with this assignment Please continue the code in .pdf (20)

01-Introduction of DSA-1.pptx
01-Introduction of DSA-1.pptx01-Introduction of DSA-1.pptx
01-Introduction of DSA-1.pptx
 
Introduction to System verilog
Introduction to System verilog Introduction to System verilog
Introduction to System verilog
 
2CPP16 - STL
2CPP16 - STL2CPP16 - STL
2CPP16 - STL
 
Numpy ndarrays.pdf
Numpy ndarrays.pdfNumpy ndarrays.pdf
Numpy ndarrays.pdf
 
procedures and arrays
procedures and arraysprocedures and arrays
procedures and arrays
 
Ashish garg research paper 660_CamReady
Ashish garg research paper 660_CamReadyAshish garg research paper 660_CamReady
Ashish garg research paper 660_CamReady
 
Unit i(dsc++)
Unit i(dsc++)Unit i(dsc++)
Unit i(dsc++)
 
Programming in C sesion 2
Programming in C sesion 2Programming in C sesion 2
Programming in C sesion 2
 
Extending High-Utility Pattern Mining with Facets and Advanced Utility Functi...
Extending High-Utility Pattern Mining with Facets and Advanced Utility Functi...Extending High-Utility Pattern Mining with Facets and Advanced Utility Functi...
Extending High-Utility Pattern Mining with Facets and Advanced Utility Functi...
 
Educational Objectives After successfully completing this assignmen.pdf
Educational Objectives After successfully completing this assignmen.pdfEducational Objectives After successfully completing this assignmen.pdf
Educational Objectives After successfully completing this assignmen.pdf
 
Standard Template Library
Standard Template LibraryStandard Template Library
Standard Template Library
 
13. Query Processing in DBMS
13. Query Processing in DBMS13. Query Processing in DBMS
13. Query Processing in DBMS
 
Redo midterm
Redo midtermRedo midterm
Redo midterm
 
Visual basic bt0082
Visual basic  bt0082Visual basic  bt0082
Visual basic bt0082
 
An Answer Set Programming based framework for High-Utility Pattern Mining ext...
An Answer Set Programming based framework for High-Utility Pattern Mining ext...An Answer Set Programming based framework for High-Utility Pattern Mining ext...
An Answer Set Programming based framework for High-Utility Pattern Mining ext...
 
Vizwik Coding Manual
Vizwik Coding ManualVizwik Coding Manual
Vizwik Coding Manual
 
DS-UNIT 1 FINAL (2).pptx
DS-UNIT 1 FINAL (2).pptxDS-UNIT 1 FINAL (2).pptx
DS-UNIT 1 FINAL (2).pptx
 
Data Structures_Introduction
Data Structures_IntroductionData Structures_Introduction
Data Structures_Introduction
 
Clustering_Algorithm_DR
Clustering_Algorithm_DRClustering_Algorithm_DR
Clustering_Algorithm_DR
 
0-Slot18-19-20-ContiguousStorage.pdf
0-Slot18-19-20-ContiguousStorage.pdf0-Slot18-19-20-ContiguousStorage.pdf
0-Slot18-19-20-ContiguousStorage.pdf
 

More from saravanan544051

Nokta grafii yerine gvde ve yaprak gsterimi yapmann avanta.pdf
Nokta grafii yerine gvde ve yaprak gsterimi yapmann avanta.pdfNokta grafii yerine gvde ve yaprak gsterimi yapmann avanta.pdf
Nokta grafii yerine gvde ve yaprak gsterimi yapmann avanta.pdfsaravanan544051
 
Notable historic volcanic eruptions include the eruption of .pdf
Notable historic volcanic eruptions include the eruption of .pdfNotable historic volcanic eruptions include the eruption of .pdf
Notable historic volcanic eruptions include the eruption of .pdfsaravanan544051
 
Nithout Crossing Over Meiosis I Microtubules shorten sepa.pdf
Nithout Crossing Over  Meiosis I Microtubules shorten sepa.pdfNithout Crossing Over  Meiosis I Microtubules shorten sepa.pdf
Nithout Crossing Over Meiosis I Microtubules shorten sepa.pdfsaravanan544051
 
Nosotros contra ellos la democracia estadounidense amenaz.pdf
Nosotros contra ellos la democracia estadounidense amenaz.pdfNosotros contra ellos la democracia estadounidense amenaz.pdf
Nosotros contra ellos la democracia estadounidense amenaz.pdfsaravanan544051
 
not exaclty sure what to do here U Sexlinked Disorders Se.pdf
not exaclty sure what to do here  U Sexlinked Disorders Se.pdfnot exaclty sure what to do here  U Sexlinked Disorders Se.pdf
not exaclty sure what to do here U Sexlinked Disorders Se.pdfsaravanan544051
 
Noras utility function is given by U lnC + lnL where.pdf
Noras utility function is given by U  lnC + lnL where.pdfNoras utility function is given by U  lnC + lnL where.pdf
Noras utility function is given by U lnC + lnL where.pdfsaravanan544051
 
Normalization BCNF Verify all tables to see whether or not.pdf
Normalization BCNF Verify all tables to see whether or not.pdfNormalization BCNF Verify all tables to see whether or not.pdf
Normalization BCNF Verify all tables to see whether or not.pdfsaravanan544051
 
Nonstandard dice can produce interesting distributions of o.pdf
Nonstandard dice can produce interesting distributions of o.pdfNonstandard dice can produce interesting distributions of o.pdf
Nonstandard dice can produce interesting distributions of o.pdfsaravanan544051
 
Nonnative species management nNative Species Management 1.pdf
Nonnative species management nNative Species Management 1.pdfNonnative species management nNative Species Management 1.pdf
Nonnative species management nNative Species Management 1.pdfsaravanan544051
 
Noras utility function is given by UlnC+lnL where U i.pdf
Noras utility function is given by UlnC+lnL where U i.pdfNoras utility function is given by UlnC+lnL where U i.pdf
Noras utility function is given by UlnC+lnL where U i.pdfsaravanan544051
 
Noce it any boxes seem not applicable leave blank The f.pdf
Noce it any boxes seem not applicable leave blank The f.pdfNoce it any boxes seem not applicable leave blank The f.pdf
Noce it any boxes seem not applicable leave blank The f.pdfsaravanan544051
 
Nonconstant Dividends LO1 McCabe Corporation is expected .pdf
Nonconstant Dividends LO1 McCabe Corporation is expected .pdfNonconstant Dividends LO1 McCabe Corporation is expected .pdf
Nonconstant Dividends LO1 McCabe Corporation is expected .pdfsaravanan544051
 
Nonprofit corporations are also called Select one a eleemo.pdf
Nonprofit corporations are also called Select one a eleemo.pdfNonprofit corporations are also called Select one a eleemo.pdf
Nonprofit corporations are also called Select one a eleemo.pdfsaravanan544051
 
Nomuras Integration of Lehman Brothers Assets in Asia and .pdf
Nomuras Integration of Lehman Brothers Assets in Asia and .pdfNomuras Integration of Lehman Brothers Assets in Asia and .pdf
Nomuras Integration of Lehman Brothers Assets in Asia and .pdfsaravanan544051
 
Non random sampling offers the best chance of choosing a sam.pdf
Non random sampling offers the best chance of choosing a sam.pdfNon random sampling offers the best chance of choosing a sam.pdf
Non random sampling offers the best chance of choosing a sam.pdfsaravanan544051
 
NoGrowth Corporation currently pays a dividend of 044 per .pdf
NoGrowth Corporation currently pays a dividend of 044 per .pdfNoGrowth Corporation currently pays a dividend of 044 per .pdf
NoGrowth Corporation currently pays a dividend of 044 per .pdfsaravanan544051
 
Nestlde ERP ve Deiim Ynetimi vaka almas analizi Vaka i.pdf
Nestlde ERP ve Deiim Ynetimi  vaka almas analizi Vaka i.pdfNestlde ERP ve Deiim Ynetimi  vaka almas analizi Vaka i.pdf
Nestlde ERP ve Deiim Ynetimi vaka almas analizi Vaka i.pdfsaravanan544051
 
No question providing a table that passes This is wha.pdf
No question providing a table that passes This is wha.pdfNo question providing a table that passes This is wha.pdf
No question providing a table that passes This is wha.pdfsaravanan544051
 
No puedo dejar de toser un estudio de caso sobre el sistema.pdf
No puedo dejar de toser un estudio de caso sobre el sistema.pdfNo puedo dejar de toser un estudio de caso sobre el sistema.pdf
No puedo dejar de toser un estudio de caso sobre el sistema.pdfsaravanan544051
 
No publique esto como respondido si NO lo responde la .pdf
No publique esto como respondido si NO lo responde la .pdfNo publique esto como respondido si NO lo responde la .pdf
No publique esto como respondido si NO lo responde la .pdfsaravanan544051
 

More from saravanan544051 (20)

Nokta grafii yerine gvde ve yaprak gsterimi yapmann avanta.pdf
Nokta grafii yerine gvde ve yaprak gsterimi yapmann avanta.pdfNokta grafii yerine gvde ve yaprak gsterimi yapmann avanta.pdf
Nokta grafii yerine gvde ve yaprak gsterimi yapmann avanta.pdf
 
Notable historic volcanic eruptions include the eruption of .pdf
Notable historic volcanic eruptions include the eruption of .pdfNotable historic volcanic eruptions include the eruption of .pdf
Notable historic volcanic eruptions include the eruption of .pdf
 
Nithout Crossing Over Meiosis I Microtubules shorten sepa.pdf
Nithout Crossing Over  Meiosis I Microtubules shorten sepa.pdfNithout Crossing Over  Meiosis I Microtubules shorten sepa.pdf
Nithout Crossing Over Meiosis I Microtubules shorten sepa.pdf
 
Nosotros contra ellos la democracia estadounidense amenaz.pdf
Nosotros contra ellos la democracia estadounidense amenaz.pdfNosotros contra ellos la democracia estadounidense amenaz.pdf
Nosotros contra ellos la democracia estadounidense amenaz.pdf
 
not exaclty sure what to do here U Sexlinked Disorders Se.pdf
not exaclty sure what to do here  U Sexlinked Disorders Se.pdfnot exaclty sure what to do here  U Sexlinked Disorders Se.pdf
not exaclty sure what to do here U Sexlinked Disorders Se.pdf
 
Noras utility function is given by U lnC + lnL where.pdf
Noras utility function is given by U  lnC + lnL where.pdfNoras utility function is given by U  lnC + lnL where.pdf
Noras utility function is given by U lnC + lnL where.pdf
 
Normalization BCNF Verify all tables to see whether or not.pdf
Normalization BCNF Verify all tables to see whether or not.pdfNormalization BCNF Verify all tables to see whether or not.pdf
Normalization BCNF Verify all tables to see whether or not.pdf
 
Nonstandard dice can produce interesting distributions of o.pdf
Nonstandard dice can produce interesting distributions of o.pdfNonstandard dice can produce interesting distributions of o.pdf
Nonstandard dice can produce interesting distributions of o.pdf
 
Nonnative species management nNative Species Management 1.pdf
Nonnative species management nNative Species Management 1.pdfNonnative species management nNative Species Management 1.pdf
Nonnative species management nNative Species Management 1.pdf
 
Noras utility function is given by UlnC+lnL where U i.pdf
Noras utility function is given by UlnC+lnL where U i.pdfNoras utility function is given by UlnC+lnL where U i.pdf
Noras utility function is given by UlnC+lnL where U i.pdf
 
Noce it any boxes seem not applicable leave blank The f.pdf
Noce it any boxes seem not applicable leave blank The f.pdfNoce it any boxes seem not applicable leave blank The f.pdf
Noce it any boxes seem not applicable leave blank The f.pdf
 
Nonconstant Dividends LO1 McCabe Corporation is expected .pdf
Nonconstant Dividends LO1 McCabe Corporation is expected .pdfNonconstant Dividends LO1 McCabe Corporation is expected .pdf
Nonconstant Dividends LO1 McCabe Corporation is expected .pdf
 
Nonprofit corporations are also called Select one a eleemo.pdf
Nonprofit corporations are also called Select one a eleemo.pdfNonprofit corporations are also called Select one a eleemo.pdf
Nonprofit corporations are also called Select one a eleemo.pdf
 
Nomuras Integration of Lehman Brothers Assets in Asia and .pdf
Nomuras Integration of Lehman Brothers Assets in Asia and .pdfNomuras Integration of Lehman Brothers Assets in Asia and .pdf
Nomuras Integration of Lehman Brothers Assets in Asia and .pdf
 
Non random sampling offers the best chance of choosing a sam.pdf
Non random sampling offers the best chance of choosing a sam.pdfNon random sampling offers the best chance of choosing a sam.pdf
Non random sampling offers the best chance of choosing a sam.pdf
 
NoGrowth Corporation currently pays a dividend of 044 per .pdf
NoGrowth Corporation currently pays a dividend of 044 per .pdfNoGrowth Corporation currently pays a dividend of 044 per .pdf
NoGrowth Corporation currently pays a dividend of 044 per .pdf
 
Nestlde ERP ve Deiim Ynetimi vaka almas analizi Vaka i.pdf
Nestlde ERP ve Deiim Ynetimi  vaka almas analizi Vaka i.pdfNestlde ERP ve Deiim Ynetimi  vaka almas analizi Vaka i.pdf
Nestlde ERP ve Deiim Ynetimi vaka almas analizi Vaka i.pdf
 
No question providing a table that passes This is wha.pdf
No question providing a table that passes This is wha.pdfNo question providing a table that passes This is wha.pdf
No question providing a table that passes This is wha.pdf
 
No puedo dejar de toser un estudio de caso sobre el sistema.pdf
No puedo dejar de toser un estudio de caso sobre el sistema.pdfNo puedo dejar de toser un estudio de caso sobre el sistema.pdf
No puedo dejar de toser un estudio de caso sobre el sistema.pdf
 
No publique esto como respondido si NO lo responde la .pdf
No publique esto como respondido si NO lo responde la .pdfNo publique esto como respondido si NO lo responde la .pdf
No publique esto como respondido si NO lo responde la .pdf
 

Recently uploaded

How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17Celine George
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxMarlene Maheu
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptNishitharanjan Rout
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfPondicherry University
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxAdelaideRefugio
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024Borja Sotomayor
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesAmanpreetKaur157993
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppCeline George
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaEADTU
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsSandeep D Chaudhary
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital ManagementMBA Assignment Experts
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptxPoojaSen20
 
MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptxPoojaSen20
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...Nguyen Thanh Tu Collection
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code ExamplesPeter Brusilovsky
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppCeline George
 

Recently uploaded (20)

How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptx
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptx
 
MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptx
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 

Need help with this assignment Please continue the code in .pdf

  • 1. Need help with this assignment. Please continue the code in C programming language. My current code is below. You are supposed to build upon this code. Instructions are under the pics of the code: Tasksv. Write decision making logic based on the value of the looping variable (i.e. algorithm) 1. When algorithm is equal to FIRST, call function firstFit, passing arguments blockSize, blocks, processSize, and processes 2. When algorithm is equal to BEST, call function bestFit, passing arguments blockSize, blocks, processSize, and processes 3. When algorithm is equal to WORST, call function worstFit, passing arguments blockSize, blocks, processSize, and processes 4. When algorithm is equal to NEXT, call function nextFit, passing arguments blockSize, blocks, processSize, and processesWrite function nextFit to do the following a. Return type void b. Parameter list includes i. One-dimensional array, data type integer, contains the block sizes (i.e. blockSize) ii. Parameter contains the number of blocks, data type integer (i.e. blocks) iii. One- dimensional array, data type integer, contains the process sizes (i.e. processSize) iv. Parameter contains the number of processes, data type integer (i.e. processes) c. Declare a one-dimensional array, data type integer, to store the block id that a process is allocated to (i.e. allocation), size is parameter processes d. Declare a variable, data type integer, to store the block allocation for a process, initialize to 0 (i.e. id) e. Call function memset, passing arguments i. Array allocation ii. -1 (i.e. INVALID) iii. sizeof(allocation) f. Using a looping construct, loop through the number of processes i. Using a looping construct, loop while id is less than the number of blocks 1. If the current block size (i.e. index id) is greater than or equal to the current process size (i.e. index of outer looping variable) a. Update the allocation array to set the element at index of the outer looping variable equal to variable id b. Reduce available memory of the current block size (i.e. index id) by the processsize (i.e. index of the outer looping variable) c. break out of the inner loop ii. Update the value of variable id to set the next index in array blockSize by adding 1 to variable id then modulus the total by the number of blocks g. Call function displayProcess passing arguments allocation, processes, and processSizeWrite function firstFit to do the following a. Return type void b. Parameter list includes i. One-dimensional array, data type integer, contains the block sizes (i.e. blockSize) ii. Parameter contains the number of blocks, data type integer (i.e. blocks) iii. One- dimensional array, data type integer, contains the process sizes (i.e. processSize) iv. Parameter contains the number of processes, data type integer (i.e. processes) c. Declare a one-dimensional array, data type integer, to store the block id that a process is allocated to (i.e. allocation), size is parameter processes d. Call function memset, passing arguments i. Array allocation ii. -1 (i.e. INVALID) iii. sizeof(allocation) e. Using a looping construct, loop through the number of processes i. Using a looping construct, loop the number of blocks 1. If the current block size (i.e. index of the inner looping variable ) is greater than or equal to the current process size (i.e. index of outer looping variable) a. Update the allocation array to set the element at index of the outer looping variable equal to the inner looping variable b. Reduce available memory of the current block size (i.e. index of the inner looping variable) by the process size (i.e. index of the outer looping variable) c. break out of the inner loop f. Call function displayProcess passing arguments allocation, processes, and processSizeWrite function bestFit to do the following a. Return type void b. Parameter list includes i. One-dimensional array, data type integer, contains the block sizes (i.e. blockSize) ii. Parameter contains the number of blocks, data type integer (i.e. blocks) iii.
  • 2. One-dimensional array, data type integer, contains the process sizes (i.e. processSize) iv. Parameter contains the number of processes, data type integer (i.e. processes) c. Declare a one- dimensional array, data type integer, to store the block id that a process is allocated to (i.e. allocation), size is parameter processes d. Call function memset, passing arguments i. Array allocation ii. -1 (i.e. INVALID) iii. sizeof(allocation) e. Using a looping construct, loop through the number of processes i. Declare a variable, data type integer, to store the current best fit value (i.e. bestIdx) initialized to -1 (i.e. INVALID) ii. Using a looping construct, loop the number of blocks 1. If the current block size (i.e. index of the inner looping variable ) is greater than or equal to the current process size (i.e. index of outer looping variable) a. If the value of bestIdx is equal to -1 (i.e. INVALID) i. Set variable bestIdx equal to the current block (i.e. the inner looping variable) b. Else if the value of the block size at index bestIdx is greater than the value of the block size at index of the inner looping variable i. Set variable bestidx equal to the current block (i.e. the inner looping variable) iii. If the value of variable bestIdx is not equal to -1 (i.e. INVALID) 1. Update the allocation array to set the element at index of the outer looping variable equal to variable bestIdx2. Reduce available memory of the current block size (i.e. index bestIdx) by the process size (i.e. index of the outer looping variable) f. Call function displayProcess passing arguments allocation, processes, and processSizeWrite function worstFit to do the following a. Return type void b. Parameter list includes i. One-dimensional array, data type integer, contains the block sizes (i.e. blockSize) ii. Parameter contains the number of blocks, data type integer (i.e. blocks) iii. One- dimensional array, data type integer, contains the process sizes (i.e. processSize) iv. Parameter contains the number of processes, data type integer (i.e. processes) c. Declare a one-dimensional array, data type integer, to store the block id that a process is allocated to (i.e. allocation), size is parameter processes d. Call function memset, passing arguments i. Array allocation ii. -1 (i.e. INVALID) iii. sizeof(allocation) e. Using a looping construct, loop through the number of processes i. Declare a variable, data type integer, to store the current worst fit value (i.e. wstIdx) initialized to -1 (i.e. INVALID) ii. Using a looping construct, loop the number of blocks 1. If the current block size (i.e. index of the inner looping variable ) is greater than or equal to the current process size (i.e. index of outer looping variable) a. If the value of wstIdx is equal to -1 (i.e. INVALID) i. Set variable wstIdx equal to the current block (i.e. the inner looping variable) b. Else if the value of the block size at index wstIdx is less than the value of the block size at index of the inner looping variable i. Set variable wstIdx equal to the current block (i.e. the inner looping variable)iii. If the value of variable wstIdx is not equal to -1 (i.e. INVALID) 1. Update the allocation array to set the element at index of the outer looping variable equal to variable wstIdx 2. Reduce available memory of the current block size (i.e. index wstIdx) by the process size (i.e. index of the outer looping variable) f. Call function displayProcess passing arguments allocation, processes, and processSize Write function displayProcess to do the following a. Return type void b. Parameter list includes i. One- dimensional array, data type integer, that stores the block number allocations (i.e. allocation) ii. Parameter that contains the number of processes, data type integer (i.e. processes) iii. One- dimensional array, data type integer, that stores the processes (i.e. processSize) c. Write a looping construct to loop through the processes (i.e. processSize) i. Display to the console the process number (i.e use the looping variable plus 1 ) ii. Display to the console the process size (i.e. processSize array at the current looping index) iii. Display to the console the memory block
  • 3. assigned based on the following logic 1. If the value stored at the current index of array processSize if -1 (i.e. INVALID), output Not Allocated 2. Else, output the current allocation (i.e. allocation)Select the OS program to run, enter the number of your selection. 1. Memory Management 2. File Management 3. Multithreading 0 . ExitFigure 2 memoryManagement function outputFigure 3 nextFit function output ********** First Fit ********** Figure 4 firstFit function outputFigure 5 bestFit function outputFigure 6 worstFit function output