SlideShare a Scribd company logo
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:
Tasks v. 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 processes Write 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 process size (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 processSize Write 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
processSize Write 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 bestIdx 2. 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 processSize Write 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 .
Exit Figure 2 memoryManagement function output Figure 3 nextFit function output **********
First Fit ********** Figure 4 firstFit function output Figure 5 bestFit function output Figure 6
worstFit function output

More Related Content

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

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
rajeshjangid1865
 
Programming in C sesion 2
Programming in C sesion 2Programming in C sesion 2
Programming in C sesion 2
Prerna Sharma
 
Introduction to System verilog
Introduction to System verilog Introduction to System verilog
Introduction to System verilog
Pushpa Yakkala
 
Unit i(dsc++)
Unit i(dsc++)Unit i(dsc++)
Unit i(dsc++)
Durga Devi
 
01-Introduction of DSA-1.pptx
01-Introduction of DSA-1.pptx01-Introduction of DSA-1.pptx
01-Introduction of DSA-1.pptx
DwijBaxi
 
2CPP16 - STL
2CPP16 - STL2CPP16 - STL
2CPP16 - STL
Michael Heron
 
procedures and arrays
procedures and arraysprocedures and arrays
procedures and arrays
DivyaR219113
 
Vizwik Coding Manual
Vizwik Coding ManualVizwik Coding Manual
Vizwik Coding Manual
Vizwik
 
Ashish garg research paper 660_CamReady
Ashish garg research paper 660_CamReadyAshish garg research paper 660_CamReady
Ashish garg research paper 660_CamReadyAshish Garg
 
13. Query Processing in DBMS
13. Query Processing in DBMS13. Query Processing in DBMS
13. Query Processing in DBMSkoolkampus
 
Numpy ndarrays.pdf
Numpy ndarrays.pdfNumpy ndarrays.pdf
Numpy ndarrays.pdf
SudhanshiBakre1
 
VB Dot net
VB Dot net VB Dot net
VB Dot net
Akber Khowaja
 
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
 
Redo midterm
Redo midtermRedo midterm
Redo midterm
IIUM
 
stacks and queues class 12 in c++
stacks and  queues class 12 in c++stacks and  queues class 12 in c++
stacks and queues class 12 in c++
Khushal Mehta
 
Clustering_Algorithm_DR
Clustering_Algorithm_DRClustering_Algorithm_DR
Clustering_Algorithm_DRNguyen Tran
 
VB_ERROR CONTROL_FILE HANDLING.ppt
VB_ERROR CONTROL_FILE HANDLING.pptVB_ERROR CONTROL_FILE HANDLING.ppt
VB_ERROR CONTROL_FILE HANDLING.ppt
BhuvanaR13
 
Visual basic bt0082
Visual basic  bt0082Visual basic  bt0082
Visual basic bt0082
Divyam Pateriya
 
Reaction StatisticsBackgroundWhen collecting experimental data f.pdf
Reaction StatisticsBackgroundWhen collecting experimental data f.pdfReaction StatisticsBackgroundWhen collecting experimental data f.pdf
Reaction StatisticsBackgroundWhen collecting experimental data f.pdf
fashionbigchennai
 
growth rates
growth ratesgrowth rates
growth rates
Rajendran
 

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

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
 
Programming in C sesion 2
Programming in C sesion 2Programming in C sesion 2
Programming in C sesion 2
 
Introduction to System verilog
Introduction to System verilog Introduction to System verilog
Introduction to System verilog
 
Unit i(dsc++)
Unit i(dsc++)Unit i(dsc++)
Unit i(dsc++)
 
01-Introduction of DSA-1.pptx
01-Introduction of DSA-1.pptx01-Introduction of DSA-1.pptx
01-Introduction of DSA-1.pptx
 
2CPP16 - STL
2CPP16 - STL2CPP16 - STL
2CPP16 - STL
 
procedures and arrays
procedures and arraysprocedures and arrays
procedures and arrays
 
Vizwik Coding Manual
Vizwik Coding ManualVizwik Coding Manual
Vizwik Coding Manual
 
Ashish garg research paper 660_CamReady
Ashish garg research paper 660_CamReadyAshish garg research paper 660_CamReady
Ashish garg research paper 660_CamReady
 
13. Query Processing in DBMS
13. Query Processing in DBMS13. Query Processing in DBMS
13. Query Processing in DBMS
 
Numpy ndarrays.pdf
Numpy ndarrays.pdfNumpy ndarrays.pdf
Numpy ndarrays.pdf
 
VB Dot net
VB Dot net VB Dot net
VB Dot net
 
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...
 
Redo midterm
Redo midtermRedo midterm
Redo midterm
 
stacks and queues class 12 in c++
stacks and  queues class 12 in c++stacks and  queues class 12 in c++
stacks and queues class 12 in c++
 
Clustering_Algorithm_DR
Clustering_Algorithm_DRClustering_Algorithm_DR
Clustering_Algorithm_DR
 
VB_ERROR CONTROL_FILE HANDLING.ppt
VB_ERROR CONTROL_FILE HANDLING.pptVB_ERROR CONTROL_FILE HANDLING.ppt
VB_ERROR CONTROL_FILE HANDLING.ppt
 
Visual basic bt0082
Visual basic  bt0082Visual basic  bt0082
Visual basic bt0082
 
Reaction StatisticsBackgroundWhen collecting experimental data f.pdf
Reaction StatisticsBackgroundWhen collecting experimental data f.pdfReaction StatisticsBackgroundWhen collecting experimental data f.pdf
Reaction StatisticsBackgroundWhen collecting experimental data f.pdf
 
growth rates
growth ratesgrowth rates
growth rates
 

More from aachalsaleswani

Let X be a continuous random variable with survival function given by (1).pdf
Let X be a continuous random variable with survival function given by (1).pdfLet X be a continuous random variable with survival function given by (1).pdf
Let X be a continuous random variable with survival function given by (1).pdf
aachalsaleswani
 
Question 2(10pts) - Calculate the equivalent uniform annual benefit (E.pdf
Question 2(10pts) - Calculate the equivalent uniform annual benefit (E.pdfQuestion 2(10pts) - Calculate the equivalent uniform annual benefit (E.pdf
Question 2(10pts) - Calculate the equivalent uniform annual benefit (E.pdf
aachalsaleswani
 
Please find this solution in C++ An OrderedList is a vector that keeps.pdf
Please find this solution in C++ An OrderedList is a vector that keeps.pdfPlease find this solution in C++ An OrderedList is a vector that keeps.pdf
Please find this solution in C++ An OrderedList is a vector that keeps.pdf
aachalsaleswani
 
Please show how to arrive at the answers shown using the provided info.pdf
Please show how to arrive at the answers shown using the provided info.pdfPlease show how to arrive at the answers shown using the provided info.pdf
Please show how to arrive at the answers shown using the provided info.pdf
aachalsaleswani
 
If X has a binomial distribution with n-4 and p-0-3- then P(X-1)- (1).pdf
If X has a binomial distribution with n-4 and p-0-3- then P(X-1)- (1).pdfIf X has a binomial distribution with n-4 and p-0-3- then P(X-1)- (1).pdf
If X has a binomial distribution with n-4 and p-0-3- then P(X-1)- (1).pdf
aachalsaleswani
 
Define a method findAnnualMembership() that takes two integer paramete.pdf
Define a method findAnnualMembership() that takes two integer paramete.pdfDefine a method findAnnualMembership() that takes two integer paramete.pdf
Define a method findAnnualMembership() that takes two integer paramete.pdf
aachalsaleswani
 
Inflation differentials and the UK effective exchange rate 1 1- UK inf.pdf
Inflation differentials and the UK effective exchange rate 1 1- UK inf.pdfInflation differentials and the UK effective exchange rate 1 1- UK inf.pdf
Inflation differentials and the UK effective exchange rate 1 1- UK inf.pdf
aachalsaleswani
 
Chapter 1- Corporations have shown good and bad ethical behavior in th.pdf
Chapter 1- Corporations have shown good and bad ethical behavior in th.pdfChapter 1- Corporations have shown good and bad ethical behavior in th.pdf
Chapter 1- Corporations have shown good and bad ethical behavior in th.pdf
aachalsaleswani
 
Can I get step by step showing calculations and how you got those numb (1).pdf
Can I get step by step showing calculations and how you got those numb (1).pdfCan I get step by step showing calculations and how you got those numb (1).pdf
Can I get step by step showing calculations and how you got those numb (1).pdf
aachalsaleswani
 
A Arawen A Acen thire b- Noider Revalde- a- Wijes fidite theweme Proti.pdf
A Arawen A Acen thire b- Noider Revalde- a- Wijes fidite theweme Proti.pdfA Arawen A Acen thire b- Noider Revalde- a- Wijes fidite theweme Proti.pdf
A Arawen A Acen thire b- Noider Revalde- a- Wijes fidite theweme Proti.pdf
aachalsaleswani
 
A small liberal arts college in the Northeast has 300 freshmen- One hu.pdf
A small liberal arts college in the Northeast has 300 freshmen- One hu.pdfA small liberal arts college in the Northeast has 300 freshmen- One hu.pdf
A small liberal arts college in the Northeast has 300 freshmen- One hu.pdf
aachalsaleswani
 
All of the following are true statements EXCEPT- Infectious diseases r.pdf
All of the following are true statements EXCEPT- Infectious diseases r.pdfAll of the following are true statements EXCEPT- Infectious diseases r.pdf
All of the following are true statements EXCEPT- Infectious diseases r.pdf
aachalsaleswani
 
A random variable X takes values between 0 and 4 with a cumulative dis.pdf
A random variable X takes values between 0 and 4 with a cumulative dis.pdfA random variable X takes values between 0 and 4 with a cumulative dis.pdf
A random variable X takes values between 0 and 4 with a cumulative dis.pdf
aachalsaleswani
 
2021 Percentage Method Tables for Manual Payroll Systems With Forms W-.pdf
2021 Percentage Method Tables for Manual Payroll Systems With Forms W-.pdf2021 Percentage Method Tables for Manual Payroll Systems With Forms W-.pdf
2021 Percentage Method Tables for Manual Payroll Systems With Forms W-.pdf
aachalsaleswani
 
5) The main difference between a Flow type and Repetitive type of prod.pdf
5) The main difference between a Flow type and Repetitive type of prod.pdf5) The main difference between a Flow type and Repetitive type of prod.pdf
5) The main difference between a Flow type and Repetitive type of prod.pdf
aachalsaleswani
 
14- -18 pts- Consider a closed economy with Demand for Consumption- In.pdf
14- -18 pts- Consider a closed economy with Demand for Consumption- In.pdf14- -18 pts- Consider a closed economy with Demand for Consumption- In.pdf
14- -18 pts- Consider a closed economy with Demand for Consumption- In.pdf
aachalsaleswani
 
Common stock shareholders generally have the rights except- Group of a.pdf
Common stock shareholders generally have the rights except- Group of a.pdfCommon stock shareholders generally have the rights except- Group of a.pdf
Common stock shareholders generally have the rights except- Group of a.pdf
aachalsaleswani
 
Cosmos Investment Corporation is exploring multiple investment opportu.pdf
Cosmos Investment Corporation is exploring multiple investment opportu.pdfCosmos Investment Corporation is exploring multiple investment opportu.pdf
Cosmos Investment Corporation is exploring multiple investment opportu.pdf
aachalsaleswani
 
-n-(fx2)-+-(x)-2 thanfed driation ( Aiend te ene decinal idese as aeed.pdf
-n-(fx2)-+-(x)-2 thanfed driation ( Aiend te ene decinal idese as aeed.pdf-n-(fx2)-+-(x)-2 thanfed driation ( Aiend te ene decinal idese as aeed.pdf
-n-(fx2)-+-(x)-2 thanfed driation ( Aiend te ene decinal idese as aeed.pdf
aachalsaleswani
 
Complete the following blanks for Questions 4-9 4- Both kidneys are lo.pdf
Complete the following blanks for Questions 4-9 4- Both kidneys are lo.pdfComplete the following blanks for Questions 4-9 4- Both kidneys are lo.pdf
Complete the following blanks for Questions 4-9 4- Both kidneys are lo.pdf
aachalsaleswani
 

More from aachalsaleswani (20)

Let X be a continuous random variable with survival function given by (1).pdf
Let X be a continuous random variable with survival function given by (1).pdfLet X be a continuous random variable with survival function given by (1).pdf
Let X be a continuous random variable with survival function given by (1).pdf
 
Question 2(10pts) - Calculate the equivalent uniform annual benefit (E.pdf
Question 2(10pts) - Calculate the equivalent uniform annual benefit (E.pdfQuestion 2(10pts) - Calculate the equivalent uniform annual benefit (E.pdf
Question 2(10pts) - Calculate the equivalent uniform annual benefit (E.pdf
 
Please find this solution in C++ An OrderedList is a vector that keeps.pdf
Please find this solution in C++ An OrderedList is a vector that keeps.pdfPlease find this solution in C++ An OrderedList is a vector that keeps.pdf
Please find this solution in C++ An OrderedList is a vector that keeps.pdf
 
Please show how to arrive at the answers shown using the provided info.pdf
Please show how to arrive at the answers shown using the provided info.pdfPlease show how to arrive at the answers shown using the provided info.pdf
Please show how to arrive at the answers shown using the provided info.pdf
 
If X has a binomial distribution with n-4 and p-0-3- then P(X-1)- (1).pdf
If X has a binomial distribution with n-4 and p-0-3- then P(X-1)- (1).pdfIf X has a binomial distribution with n-4 and p-0-3- then P(X-1)- (1).pdf
If X has a binomial distribution with n-4 and p-0-3- then P(X-1)- (1).pdf
 
Define a method findAnnualMembership() that takes two integer paramete.pdf
Define a method findAnnualMembership() that takes two integer paramete.pdfDefine a method findAnnualMembership() that takes two integer paramete.pdf
Define a method findAnnualMembership() that takes two integer paramete.pdf
 
Inflation differentials and the UK effective exchange rate 1 1- UK inf.pdf
Inflation differentials and the UK effective exchange rate 1 1- UK inf.pdfInflation differentials and the UK effective exchange rate 1 1- UK inf.pdf
Inflation differentials and the UK effective exchange rate 1 1- UK inf.pdf
 
Chapter 1- Corporations have shown good and bad ethical behavior in th.pdf
Chapter 1- Corporations have shown good and bad ethical behavior in th.pdfChapter 1- Corporations have shown good and bad ethical behavior in th.pdf
Chapter 1- Corporations have shown good and bad ethical behavior in th.pdf
 
Can I get step by step showing calculations and how you got those numb (1).pdf
Can I get step by step showing calculations and how you got those numb (1).pdfCan I get step by step showing calculations and how you got those numb (1).pdf
Can I get step by step showing calculations and how you got those numb (1).pdf
 
A Arawen A Acen thire b- Noider Revalde- a- Wijes fidite theweme Proti.pdf
A Arawen A Acen thire b- Noider Revalde- a- Wijes fidite theweme Proti.pdfA Arawen A Acen thire b- Noider Revalde- a- Wijes fidite theweme Proti.pdf
A Arawen A Acen thire b- Noider Revalde- a- Wijes fidite theweme Proti.pdf
 
A small liberal arts college in the Northeast has 300 freshmen- One hu.pdf
A small liberal arts college in the Northeast has 300 freshmen- One hu.pdfA small liberal arts college in the Northeast has 300 freshmen- One hu.pdf
A small liberal arts college in the Northeast has 300 freshmen- One hu.pdf
 
All of the following are true statements EXCEPT- Infectious diseases r.pdf
All of the following are true statements EXCEPT- Infectious diseases r.pdfAll of the following are true statements EXCEPT- Infectious diseases r.pdf
All of the following are true statements EXCEPT- Infectious diseases r.pdf
 
A random variable X takes values between 0 and 4 with a cumulative dis.pdf
A random variable X takes values between 0 and 4 with a cumulative dis.pdfA random variable X takes values between 0 and 4 with a cumulative dis.pdf
A random variable X takes values between 0 and 4 with a cumulative dis.pdf
 
2021 Percentage Method Tables for Manual Payroll Systems With Forms W-.pdf
2021 Percentage Method Tables for Manual Payroll Systems With Forms W-.pdf2021 Percentage Method Tables for Manual Payroll Systems With Forms W-.pdf
2021 Percentage Method Tables for Manual Payroll Systems With Forms W-.pdf
 
5) The main difference between a Flow type and Repetitive type of prod.pdf
5) The main difference between a Flow type and Repetitive type of prod.pdf5) The main difference between a Flow type and Repetitive type of prod.pdf
5) The main difference between a Flow type and Repetitive type of prod.pdf
 
14- -18 pts- Consider a closed economy with Demand for Consumption- In.pdf
14- -18 pts- Consider a closed economy with Demand for Consumption- In.pdf14- -18 pts- Consider a closed economy with Demand for Consumption- In.pdf
14- -18 pts- Consider a closed economy with Demand for Consumption- In.pdf
 
Common stock shareholders generally have the rights except- Group of a.pdf
Common stock shareholders generally have the rights except- Group of a.pdfCommon stock shareholders generally have the rights except- Group of a.pdf
Common stock shareholders generally have the rights except- Group of a.pdf
 
Cosmos Investment Corporation is exploring multiple investment opportu.pdf
Cosmos Investment Corporation is exploring multiple investment opportu.pdfCosmos Investment Corporation is exploring multiple investment opportu.pdf
Cosmos Investment Corporation is exploring multiple investment opportu.pdf
 
-n-(fx2)-+-(x)-2 thanfed driation ( Aiend te ene decinal idese as aeed.pdf
-n-(fx2)-+-(x)-2 thanfed driation ( Aiend te ene decinal idese as aeed.pdf-n-(fx2)-+-(x)-2 thanfed driation ( Aiend te ene decinal idese as aeed.pdf
-n-(fx2)-+-(x)-2 thanfed driation ( Aiend te ene decinal idese as aeed.pdf
 
Complete the following blanks for Questions 4-9 4- Both kidneys are lo.pdf
Complete the following blanks for Questions 4-9 4- Both kidneys are lo.pdfComplete the following blanks for Questions 4-9 4- Both kidneys are lo.pdf
Complete the following blanks for Questions 4-9 4- Both kidneys are lo.pdf
 

Recently uploaded

Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
Reflective and Evaluative Practice...pdf
Reflective and Evaluative Practice...pdfReflective and Evaluative Practice...pdf
Reflective and Evaluative Practice...pdf
amberjdewit93
 
What is the purpose of studying mathematics.pptx
What is the purpose of studying mathematics.pptxWhat is the purpose of studying mathematics.pptx
What is the purpose of studying mathematics.pptx
christianmathematics
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
Krisztián Száraz
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
Assignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docxAssignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docx
ArianaBusciglio
 
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
NelTorrente
 
MERN Stack Developer Roadmap By ScholarHat PDF
MERN Stack Developer Roadmap By ScholarHat PDFMERN Stack Developer Roadmap By ScholarHat PDF
MERN Stack Developer Roadmap By ScholarHat PDF
scholarhattraining
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
Bisnar Chase Personal Injury Attorneys
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 

Recently uploaded (20)

Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
Reflective and Evaluative Practice...pdf
Reflective and Evaluative Practice...pdfReflective and Evaluative Practice...pdf
Reflective and Evaluative Practice...pdf
 
What is the purpose of studying mathematics.pptx
What is the purpose of studying mathematics.pptxWhat is the purpose of studying mathematics.pptx
What is the purpose of studying mathematics.pptx
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
Assignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docxAssignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docx
 
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
 
MERN Stack Developer Roadmap By ScholarHat PDF
MERN Stack Developer Roadmap By ScholarHat PDFMERN Stack Developer Roadmap By ScholarHat PDF
MERN Stack Developer Roadmap By ScholarHat PDF
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 

Need help with this assignment- Please continue the code in C programm.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: Tasks v. 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 processes Write 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 process size (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 processSize Write 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 processSize Write 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
  • 2. 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 bestIdx 2. 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 processSize Write 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 . Exit Figure 2 memoryManagement function output Figure 3 nextFit function output **********
  • 3. First Fit ********** Figure 4 firstFit function output Figure 5 bestFit function output Figure 6 worstFit function output