سلام
انا محتاجة لتنفيذ هذا البرنامج على عدة انظمة تشغيل واستخراج النتائج ومنها نظام لينكس و اينكس
و بماني ليس لدي هذين انظامين غفكرت في منتداكم وارجوا ان اجد من يساعدني في استخراج النتائج.
الكود يقوم بحساب وقت انتظار ثراد في طابور انتظار المعالج المزكزي وكل مرة نزيد عدد الثراد ونقوم بحساب المتغيرين Ecart and load
مرحلة 1: المرة الاولى تشغيل الثراد chargeur لوحده ثم تسجيل وقت اللازم لتنفيد المتمثل في المتغير ecart
مرحلة 2: حساب قيمة nbr
nbr=(ecart-quantum)/quantum {quantum is the cpu time quantum in linux sceduling process)
او وضع nbr=100
مرحلة3 : ممكن تغيير قيمة nbr حيث انه متعلق بسرعة المعالج و نظام التشغيل , انا ما يهمني انه يجب ان تظهر قيمته قبل قيمة
المتغيرecart
طلب 3: تشغيل الثراد chargeur and estimation in the same time و تسجيل قيمة المتغيرين ecart and load
طلب 4:تنفيذ البرنامج بتشغيل charg1 , charg2 , estimation
طلب 5:تنفيذ البرنامج بتشغيل charg1 , charg2 ,charge3, estimation
طلب 6 :تنفيذ البرنامج بتشغيل charg1 , charg2 ,harge3, charg4, estimation
وفي كل مرة تسجيل قيمة المتغيرين ecart and load
انتظركم
Code
public class loadestim {
public static long tempsm;
public static void main (String [] args) throws InterruptedException{
chargeur charg1=new chargeur();
charg1.start();
//chargeur charg2=new chargeur();
// charg2.start();
Estimation estimation= new Estimation() ;
estimation.start() ;
//chargeur charg4=new chargeur();
// charg4.start();
// chargeur charg3=new chargeur();
// charg3.start();
}
static class Estimation extends Thread {
long temps;
long t1;long t2;
long tot=0;
public void run(){
int nbr=120;
t1=System.nanoTime();
for ( int i=0; i<nbr;i++)
yield();
t2=System.nanoTime();
tot=(t2-t1)/1000000;
tempsm=tot/nbr;
System.out.println("load="+tempsm);
}
}
static class chargeur extends Thread {
int tab1[][];
int tab2[][];
int tab3[][];
int pr=0;
int l;
int p=2;
public void run(){
l=450;
tab1=new int[l][l];
tab2=new int[l][l];
tab3=new int[l][l];
long t0=System.nanoTime();
System.out.println("t0:"+t0);
for ( int i=0 ; i<l; i++){
for ( int j=0 ; j<l; j++){
tab1[j]=i*5 ;
tab2[j]=i*j ;
}}
for ( int j=0 ; j<l; j++){
for ( int k=0 ; k<l; k++){
for (int i=0;i<l;i++){
pr=pr+tab1[k]*tab2[j];
tab3[k][j]=pr;
}}}System.out.println("ok");
long t01=System.nanoTime();
System.out.println("t01:"+t01);
long ecart=(t01-t0)/1000000;System.out.println("ecart: "+ecart);
}
}}
code/


















