Alright, I am taking a summer course on Operating Systems and it has been a while since I took Java. I am trying to re-learn everything that I have forgotten. In my field, Java was only required as an introduction class and therefore my level of programming in a computer language that is not on the web has never reached this level.

With that said, I am about to dive into the code and I was hoping to start a thread here to receive some help. My main problem is I am not even sure where to begin.

The first part of my assignment is to: Write an event-driven simulation to help decide which storage placement strategy should be used. Run the program until all jobs have been executed with the memory as is.

The second part deals with running the program a second time but with best-fit. I'm assuming this should be two separate programs, correct?

I assume I can put my Job list and my Memory List into two arrays and work from there, somehow attempting to put my Job List into my Memory List. My job list has 25 items and my memory list has 10 items, so I need a way to run them through I assume. This is highly confusing to me. I have been looking for a simple example and I am not finding one. I can usually get this stuff easily with an example online, does anyone know where I could find one?

I have to measure the throughput and percentage of partitions used, etc, waiting queue length, waiting time in queue, and internal fragmentation. Not sure how to measure these things. So I guess my main question is does anyone know of an example of this somewhere online or in a book?

Recommended Answers

All 4 Replies

I guess you have variable sized memory partitions... In first fit, take the first job loop through the memory list and find a memory partition which has enough available memory to hold that particular job. The moment a partition is found with enough memory space fill it with that job.

For best fit, Take one job and loop through the available memory list... calculate the difference between the size of the memory partition and the job size and find a job with a minimum (positive) difference. That gives the index of the best fit partition for a job. Think in similar lines for the others...

This is exactly what I am trying to do. I so far have created two classes which hold my two separate arrays. The memory partitions are variable sized.

In my job array I have job number, size, and time, and in my memory array I have memory location number and memory size. So I will take the array and loop it through the other array I assume? These are multi-dimensional arrays, so I am a little concerned about writing a loop for that, but I've got a great big book in front of me that I hope shows me how.

I will continue working with the source code and post it if I have a problem later. (I'm sure I will.)

HI, I THINK THIS MIGHT HELP YOU.
Click Here

commented: Do you really think he's still waiting for an answer after 5 years? -3
commented: spammer, scammer, who knows. -3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.