HELP: allocateprocess() to deallocateprocess()

Please support our Perl advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Apr 2003
Posts: 1
Reputation: rozalla2002 is an unknown quantity at this point 
Solved Threads: 0
rozalla2002 rozalla2002 is offline Offline
Newbie Poster

HELP: allocateprocess() to deallocateprocess()

 
0
  #1
Apr 16th, 2003
using the following allocate process function i need a deallocate process function but i dont know how to do it. :unsure: Could anyone help?

Here is the code:
  1. sub allocateProcess()
  2. {
  3. my $found=0;
  4. my $sizeNeeded=0;
  5. my $spaceNotFound=0;
  6. my $ID=0;
  7. my $size=0;
  8.  
  9. system("clear");
  10. print "Process ID: ";
  11. $ID=<STDIN>;
  12. chomp($ID);
  13.  
  14. for($i=0;$i<$processes;$i++)
  15. {
  16. if($processTable[$i]->ID == $ID)
  17. {
  18. $sizeNeeded=$processTable[$i]->size;
  19. $found=1;
  20. } ##if
  21. } ##for
  22. if($found==1)
  23. {
  24. for($i=$OS_SIZE;$i<$MAX_RAM;$i++)
  25. {
  26. if($ram[$i] == 0)
  27. {
  28. $spaceNotFound=0;
  29. for($j=0;$j<$sizeNeeded;$j++)
  30. {
  31. if($i+$j<=$MAX_RAM)
  32. {
  33. if($ram[$i] != 0)
  34. {
  35. $spaceNotFound=1;
  36. } #if
  37. } #if
  38. else
  39. {
  40. $spaceNotFound=1;
  41. }
  42. } ##for
  43. if($spaceNotFound == 0)
  44. {
  45. for($x=0;$x<$sizeNeeded;$x++)
  46. {
  47. $ram[$x+$i]=$ID;
  48. } #for
  49. return;
  50. } ##if
  51. } ##if
  52.  
  53. } ###for
  54. } ####if
  55. elsif($found==0)
  56. {
  57. print "ID not found";
  58. }
  59. print "\n\n Press Return to continue...";
  60. $continue=<STDIN>;
  61. }
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Perl Forum
Thread Tools Search this Thread



Tag cloud for Perl
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC