let init_state i codes = let process = { pcode = i; preg = Array.make register_number 0; quantum = 0; pid = 1; ppid = 0; state = Ready; ptable_size = ptable_size; } in process.preg.(pt) <- new_ptable (); (* réservation de la table des pages *) let pids = Hashtbl.create 13 in Hashtbl.add pids 1 process; let last_pid = ref 1 in let rec new_pid() = incr last_pid; try ignore (Hashtbl.find pids !last_pid); new_pid() with Not_found -> !last_pid in { processes = pids; active_processes = [ process ]; current = process; codes = codes; new_pid = new_pid };; |