| | |
HELP: allocateprocess() to deallocateprocess()
Please support our Perl advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Apr 2003
Posts: 1
Reputation:
Solved Threads: 0
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:
Here is the code:
Perl Syntax (Toggle Plain Text)
sub allocateProcess() { my $found=0; my $sizeNeeded=0; my $spaceNotFound=0; my $ID=0; my $size=0; system("clear"); print "Process ID: "; $ID=<STDIN>; chomp($ID); for($i=0;$i<$processes;$i++) { if($processTable[$i]->ID == $ID) { $sizeNeeded=$processTable[$i]->size; $found=1; } ##if } ##for if($found==1) { for($i=$OS_SIZE;$i<$MAX_RAM;$i++) { if($ram[$i] == 0) { $spaceNotFound=0; for($j=0;$j<$sizeNeeded;$j++) { if($i+$j<=$MAX_RAM) { if($ram[$i] != 0) { $spaceNotFound=1; } #if } #if else { $spaceNotFound=1; } } ##for if($spaceNotFound == 0) { for($x=0;$x<$sizeNeeded;$x++) { $ram[$x+$i]=$ID; } #for return; } ##if } ##if } ###for } ####if elsif($found==0) { print "ID not found"; } print "\n\n Press Return to continue..."; $continue=<STDIN>; }
![]() |
Other Threads in the Perl Forum
- Previous Thread: Error in Wrox Book
- Next Thread: embPerl or PHP
| Thread Tools | Search this Thread |
Tag cloud for Perl





