function in C using nested for loops?

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter18: Stacks And Queues
Section: Chapter Questions
Problem 18PE
icon
Related questions
Question

How would I write the memory management function in C using nested for loops?

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
Transcribed Image Text: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
preprocessor
main
memory Management
2. Add function prototype for functions
memoryManagement
b. displayProcess
c. firstFit
d. worstFit
e. bestFit
f. nextFit
3. Update the main function to do the following
a. Update decision making logic to determine which OS function
to run based on the following
1 = call function memoryManagement
4. Write function memoryManagement to do the following
a. Return type void
b.
c.
d.
Empty parameter list
Call function clearScreen
Write a looping construct to loop for each of the four memory
management algorithms
i. Declare a one-dimensional array, data type integer, to
store the sizes of the memory blocks (i.e. blockSize)
initialized with values 80, 10, 65, 35, 70
ii. Declare a one-dimensional array, data type integer, to
store the sizes of the processes (i.e. processSize)
initialized with values 25, 70, 5, 45, 60
iii.
iv.
Declare a variable, data type integer, to store the
number of blocks (i.e. blocks)
Declare a variable, data type integer, to store the
number of processes (i.e. processes)
Transcribed Image Text:preprocessor main memory Management 2. Add function prototype for functions memoryManagement b. displayProcess c. firstFit d. worstFit e. bestFit f. nextFit 3. Update the main function to do the following a. Update decision making logic to determine which OS function to run based on the following 1 = call function memoryManagement 4. Write function memoryManagement to do the following a. Return type void b. c. d. Empty parameter list Call function clearScreen Write a looping construct to loop for each of the four memory management algorithms i. Declare a one-dimensional array, data type integer, to store the sizes of the memory blocks (i.e. blockSize) initialized with values 80, 10, 65, 35, 70 ii. Declare a one-dimensional array, data type integer, to store the sizes of the processes (i.e. processSize) initialized with values 25, 70, 5, 45, 60 iii. iv. Declare a variable, data type integer, to store the number of blocks (i.e. blocks) Declare a variable, data type integer, to store the number of processes (i.e. processes)
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
ADT and Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,