程序代写代做 C clock Program Description

Program Description
At one large batch-processing computer installation, the management wants to decide what storage placement strategy will yield the best possible performance. The installation runs a large real storage computer (as opposed to “virtual” storage) under either fixed or dynamic partition multi-programming. Each user program runs in a single group of contiguous storage locations. Users state their storage requirements and time units for CPU usage on their Job Control Card (it used to, and still does, work this way, although cards may not be used). The operating system allocates to each user the appropriate partition and starts up the user’s job. The job remains in memory until completion. A total of 50,000 memory locations are available, divided into blocks as indicated in the table under Test Case for Suggested Exercise 02.
Your program should help decide which storage placement strategy (first-fit or best-fit) should be used at this installation under a) fixed partitioned multi-programming, and b) dynamic partitioned multi-programming. Your program would use the job stream and memory as indicated, and run an event-driven simulation until all the jobs have been executed with the memory as is. Note that your program need to investigate the performance of the system, using the given job stream, by measuring the following:
• throughput, how many jobs are processed per given time unit;
• storage utilization, the percentage of partitions never used, the percentage of partitions heavily used;
• waiting queue length;
• waiting time in queue;
• internal or external fragmentation
Program Considerations
Given the jobs are served on first-come, first-served (FCFS) basis, while programming the above event-driven simulation, you must:
• Explain how the system handles conflicts when jobs are put into a waiting queue, and there are jobs still entering the system. Which job goes first?
• Explain how the system handles the “job clocks,” which keep track of the amount of time each job has run, and the “wait clocks,” which keep track of how long each job in the waiting queue has to wait.
• Explain how you define an “event”, since this is an event-driven system, and what happens in your system when the event occurs.
• Examine the results from the best-fit run and compare them with the results from the first-fit run:
• Explain what the results indicate about the performance of the system for this job mix and memory organization.
• Is one method of partitioning better than the other? Why or why not?
• Could you recommend one method over the other given your sample run? Would this hold in all possible cases?
• Write some conclusions and recommendations.
Work Steps
• Write a ANSI C program to fulfill the following operating system tasks in main memory management using a) fixed (static) partitioned, and b) dynamic partitioned contiguous allocation methods:
• Your program should run to produce a screen “Welcome to Static and Dynamic Partitioned Main Memory Allocation Service!”
• Your program should print the menu of memory allocation schemes under the above screen, and ask the user to select:
• One of the two memory organization schemes: a) Static Partitioned Memory Allocation, or b) Dynamic Partitioned Memory Allocation;
• One of the following memory allocation schemes: a) First-Fit Allocation, b) Best-Fit Allocation
• Your program should ask for the following two lists after the selection of memory allocation scheme, using a) interactive input via the keyboard, and b) file input via reading an external data file (text file):
• Input the job list, with memory requirements (MB) for each job
• Input the main memory block size (MB) and/or the number of fixed partitions with the size of each partition
• Your program should output the memory map showing which partitions have been allocated to which jobs (programs) using the selected memory allocation scheme.
• Your program should produce the following measures:
• throughput, how many jobs are processed per given time unit;
• storage utilization, the percentage of partitions never used, the percentage of partitions heavily used;
• waiting queue length;
• waiting time in queue;
• internal or external fragmentation
• Your program must be well documented so that your program logic could be traced with reasonable ease and clarity.
• Design your program using structured programming approach (divide-and-conquer), such that each major service is supposed to be implemented with a specific function (procedure), including:
• User interface function (e.g., welcome screen)
• Function to Input test data (e.g., arriving job list with memory requirements, main memory block size) – interactive input and/or file input
• Function to output memory map with attendant internal or external fragmentation across memory partitions, if ever allocated, to any of the arriving jobs (programs) – screen output and/or file output
• Function to process memory requests from arriving jobs – one function per memory allocation scheme – first-fit, best-fit, next-fit, and worst-fit
• Function to input from external data file(s) of arriving job lists and memory block size
• Function to output to external data file(s) of memory maps after processing memory requests from arriving jobs
• Function to document suggested answer of the given test-case; namely, set of output memory maps (including internal or external fragmentation) with different input job lists and memory block sizes, using different memory allocation schemes
• State clearly any assumptions you have made when implementing the event-driven simulation (of the given test-case) for the contiguous memory allocation schemes in this Suggested Exercise 02.
Test Steps
• Compile your C program (main program plus other sub-programs) and test-run it to show how it works to satisfy the program requirements.
• Use the following input test-case when running your completed program – input through a) interactive input via the keyboard, and b) file input via reading an external data file (text file)
Test Case for Suggested Exercise 02 
Jobs arriving in the order of (Job 1, 2, 3, …, 23, 24, 25) and with main memory capacity of 50000 memory locations – divided into 10 blocks with their respective sizes shown: