Hi ppl I would really appreciate if someone help me out here. I really tried to do this problem and its driving me crazy. All I could get is the algorithum of worst fit, best-fit next fit and first fit. Please help me as soon as I can. And I will help ppl with anything I can.

This is the prb please just help me started I would really appreciate the help

The problem it to implement first fit, best fit next fit and worst fit
1. must input mem size and the number and sizes of all the partitions
all the partitions (limit the max num of the partitions to 5)
2. for each partition you should create a descriptor with at least the following info.
partition size;
partition num;
partition status (free/busy)
size of unused space("hole")
job name (ex: j01 or j15)

input the job list that includes
job name;
job size

Recommended Answers

All 5 Replies

This is the third time you've asked the same question, maybe no one here can help you, but then again, maybe you're asking the question wrong. I'll leave this thread unlocked on the off chance that some kind soul wants to tell you what's wrong about your question.

Narue can't you help me?

Yes, I can. The instant you ask a smart question I'll be happy to.

ok i know that the first_fit algorithum is

we set counter to 1
we do this while counter<=number of blocks in mem
if job_size > mem_size(counter)
then counter= counter+1
load job into mem_size(counter)
adjust free/busy memory lists
go to step 4
end do
put the job in waiting queue
go fetch the next job

intialize mem_block(0)=99999
computer intial_mem_waste=mem_block(0)-job_size
intialize subscript=0
set counter to 1
Do while counter<=num of blocks in mem
if job_size>mem_size(counter)
then counter =counter+1
if intial_mem_waste>mem_waste
then subscript=counter
end do
if subscript=0
then put the job in waiting queue
load job into mem_size(subscript)
adjust free/busy mem lists
go fetch next job

to load job in a fixed partition
determine job's requested mem size
if job_size>size of the largest partiton
then reject the job
print appropriate message to operator
go to step 1 to handle next job in line
continue with step 3
set counter to 1
do while counter<=number of partiotions in mem
if job_size>mem_partition_size(counter)
then counter=counter+1
if mem_partition_status(counter)="free"
then load job into memory_partition(counter)
change memory_partion_status(counter) to "busy"
go to step 1
end do
no partition available at this time put job in waiting queue get next job
go to step 1

deallocate mem blocks
if Job_location is adjacent to one or more free blocks
if job_location is btwn two free blocks
the merge all three blocks into one block
set status of mem_size(counter+1) to null entry
merge both blocks into one
search for null entry in free mem list
enter job_size and beginning_address in the entry slot
set its status to "free"

Ok my question is how would or can you help me code this properly please?

As Narue pointed out, you already asked this question, where you received some help on it. To help keep this site organized, and to help you find the answers you're looking for, we request that you only start one thread per question.

I am locking this thread. Everyone can participate in the other thread at [thread]19839[/thread]

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.