Reputation: 109 Stalwart
- Active Posts:
- 1,530 (0.59 per day)
- 25-January 07
- Profile Views:
- Last Active:
- Jun 24 2013 05:41 AM
- OS Preference:
- Who Cares
- Favorite Browser:
- Favorite Processor:
- Who Cares
- Favorite Gaming Platform:
- Your Car:
- Who Cares
- Dream Kudos:
Posts I've Made
Posted 11 Apr 2012From what you wrote there I understand that it's just a simulation so you don't need to play with actual processes.
The simplest thing that could be done is have one structure that simulates process and make a list data structure out of it. Have another structure which simulates memory blocks and make free blocks allocated blocks lists for it.
Now as First fit says, all you have to do is check how much memory your process is asking for, see which block in free memory list has equal to or more than memory required (you stop searching at first match) and allocate it. While releasing you do opposite of it.
This is just very basic idea of what it could be. Important thing is how you manage these memory lists and how you manage memory blocks.
No one is going to give you code or any specific help unless you come up with more details about what kind of help you want and what you have done till now.
Posted 10 Apr 2012Please don't double post. It's not going to help you to get answers faster.
Posted 2 Apr 2012multiple mistakes in there...
your variables "ave,aveb" both are local variables in 2 different functions. So even though you are calculating their values inside "store" function their scope finishes with that function itself. What you will get in "ave,aveb" of function "grade" is just garbage!
but even to get that, you didn't even called the "grade" function in main! How you are expecting to print a grade? (that too before calling "store" function which calculates "ave,aveb" variables. Then you are using them to calculate grade in "grade" function... which you didn't called.)
Posted 30 Mar 2012The code
for(int j=0; i<number; j++)you gave me was not right but thank you for giving me the wrong code so I could learn by cracking my brain
Its solved now thanks )
yes. Glad you could find it.
btw, If you have the solution then please post your final working code here so that when someone else searches for solution to similar problem; they will get it easily.
Posted 30 Mar 2012
Never ask for anything until you show your efforts first.
It's adding for(int j=0; i<number; j++) and removing number increment.
I would also suggest to check if number is less than 1 instead of checking if it is equal to one in if statement.
There are other things to optimize as well, but let it be. Get this one running first.
- Member Title:
- C Surfing ∞
- Age Unknown
- June 24
- Years Programming:
- Programming Languages:
- C, C++, Java, J2EE, J2ME, .NET, PHP
- Website URL: