// Mettre en attente un processus s'il doit attendre à la barrière private void attenteSiBarriere(Processus processus) { foreach (Barriere barriere in lstBarrieres) { if (barriere.getBarrierePassee() == false) { foreach (KeyValuePair <int, int> kvp in barriere.getBarriere()) { if (processus.getPID() == kvp.Key) { if (processus.getNbInstructionsExecutees() == kvp.Value) { processus.mettreEnAttenteBarriere(); processus.setEtat(Enums.etatProcessus.Pret); foreach (Thread thread in processus.getThreads()) { thread.setEtat(Enums.etatThread.Pret); updateInfoThread(processus); } } } } } } }
// Update les informations d'un thread private void updateInfoThread(Processus processus) { int indexThread = 0; foreach (Thread thread in processus.getThreads()) { indexThread = getThreadAffiche(thread); dgv_RAM.Columns[indexThread].Name = thread.getInfoThread(processus); } }
// Trouver le nombre d'instructions que possède un processus private int trouverNbInstructionsProcessus(Processus processus) { int nbInstructions = 0; foreach (Thread thread in processus.getThreads()) { nbInstructions += thread.getInstructions().Count; } return(nbInstructions); }
// Décrémenter la priorité (pour le PP uniquement) private void decrementerPriorite(Processus processus) { if (executePCA == false) { processus.setPriorite(); foreach (Thread thread in processus.getThreads()) { thread.setPriorite(); updateInfoThread(processus); } } }