| | |
Can someone help at least get started its due monday please
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Mar 2005
Posts: 12
Reputation:
Solved Threads: 0
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.
Thanks
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
Thanks
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
Last edited by Iamhere; Mar 11th, 2005 at 8:50 pm. Reason: shorter
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.
New members chased away this month: 4
Yes, I can. The instant you ask a smart question I'll be happy to.
New members chased away this month: 4
•
•
Join Date: Mar 2005
Posts: 12
Reputation:
Solved Threads: 0
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
else
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
best-fit
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
else
mem_waste=memory_size(counter)-job_size
if intial_mem_waste>mem_waste
then subscript=counter
intialize_mem_waste=mem_waste
counter=counter+1
end do
if subscript=0
then put the job in waiting queue
else
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
else
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
else
if mem_partition_status(counter)="free"
then load job into memory_partition(counter)
change memory_partion_status(counter) to "busy"
go to step 1
else
counter=counter+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
then
if job_location is btwn two free blocks
the merge all three blocks into one block
mem_size(counter-1)=mem_size(counter-1)+job_size+mem_size(counter+1)
set status of mem_size(counter+1) to null entry
else
merge both blocks into one
mem_size(counter-1)=mem_size(counter-1)+job_size
else
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?
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
else
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
best-fit
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
else
mem_waste=memory_size(counter)-job_size
if intial_mem_waste>mem_waste
then subscript=counter
intialize_mem_waste=mem_waste
counter=counter+1
end do
if subscript=0
then put the job in waiting queue
else
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
else
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
else
if mem_partition_status(counter)="free"
then load job into memory_partition(counter)
change memory_partion_status(counter) to "busy"
go to step 1
else
counter=counter+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
then
if job_location is btwn two free blocks
the merge all three blocks into one block
mem_size(counter-1)=mem_size(counter-1)+job_size+mem_size(counter+1)
set status of mem_size(counter+1) to null entry
else
merge both blocks into one
mem_size(counter-1)=mem_size(counter-1)+job_size
else
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 http://www.daniweb.com/forums/thread19839.html
I am locking this thread. Everyone can participate in the other thread at http://www.daniweb.com/forums/thread19839.html
Dani the Computer Science Gal 
Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds

Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds
![]() |
Similar Threads
- Problem grabbing the lowest value in C++ (C++)
- QuickSort (Computer Science)
- Need Help Outputting Information Using Arrays In QBasic (Legacy and Other Languages)
- Operating Systems assignment (C++)
Other Threads in the C Forum
- Previous Thread: Stored procedure call with ADO
- Next Thread: strange problem
| Thread Tools | Search this Thread |
Tag cloud for C
#include * append array arrays asterisks binarysearch calculate changingto char character cm command copyimagefile cprogramme creafecopyofanytypeoffileinc database directory dynamic execv feet fgets file fork forloop framework function functions givemetehcodez grade graphics gtkwinlinux hacking histogram homework include incrementoperators input intmain() iso kernel keyboard km lazy license linked linkedlist linux list lists locate logical_drives looping loopinsideloop. lowest matrix microsoft motherboard mqqueue number oddnumber odf opensource overwrite owf pdf performance pointer posix problem probleminc process program programming radix recursion recv recvblocked research reversing scanf scripting segmentationfault sequential socket socketprograming spoonfeeding standard string student systemcall testing threads turboc unix user variable wab whythiscodecausesegmentationfault windowsapi





