Программа дисциплины для студентов


Үш түрлі желіні паралельді бір процессорда жұмыс істету



бет27/45
Дата06.01.2022
өлшемі0,76 Mb.
#12433
түріБағдарламасы
1   ...   23   24   25   26   27   28   29   30   ...   45
Үш түрлі желіні паралельді бір процессорда жұмыс істету:

#include
nettype TrivialNet(int n, int m) {

coord I=n;

parent [m];

};
int [*]main() {

[host]MPC_Printf("I'm host. I'll be a parent of net1.\n\n");

{

net TrivialNet(3,0) net1;



int [net1]mycoordinnet1;
mycoordinnet1 = I coordof net1;

[net1]:



if(mycoordinnet1)

MPC_Printf("I'm a regular member of net1. "

"My coordinate in net1 is %d.\n"

" I'll be a parent of net%d.\n\n",

mycoordinnet1, mycoordinnet1+1);

else

MPC_Printf("I'm a parent of net1. "

"My coordinate in net1 is %d.\n\n", mycoordinnet1);

{

net TrivialNet(3,1) [net1:I==1]net2;

net TrivialNet(3,2) [net1:I==2]net3;
[net2]: {

int mycoordinnet2;

mycoordinnet2 = I coordof net2;

if(mycoordinnet2!=1)

MPC_Printf("I'm a regular member of net2. "

"My coordinate in net2 is %d.\n\n",



mycoordinnet2);

else

MPC_Printf("I'm a parent of net2. "

"My coordinate in net2 is %d.\n\n",



mycoordinnet2);

}

[net3]: {



int mycoordinnet3;

mycoordinnet3 = I coordof net3;

if(mycoordinnet3!=2)

MPC_Printf("I'm a regular member of net3. "

"My coordinate in net3 is %d.\n\n",



mycoordinnet3);

else

MPC_Printf("I'm a parent of net3. "

"My coordinate in net3 is %d.\n\n",



mycoordinnet3);

}

}



[net1]:

if(mycoordinnet1)

MPC_Printf("I'm a regular member of net1. "

"My coordinate in net1 is %d.\n"

" I was a parent of net%d.\n\n",

mycoordinnet1, mycoordinnet1+1);

}

[host]MPC_Printf("I'm host. I was a parent of net1.\n\n");



}

Run командасына көшу үшін esc пернесін басу керек. Осы кезде шыққан нәтижеге назар аударыңыз.


1. Жүйенің өңдеу командасына кіріп мынадай өзгеріс енгізіңіз. Топ номері жаңа жолдан енгізілетін болсын.
2. жаңа кез келген жол қосыңыз

Бақылау сұрақтары:
1. Процедуралық тілдердегі программалардың mpC-дағы программаларан қандай айырмашылығы бар.
2. mpC тілінің қолдану аймақтары қандай?
3. mpC негізгі түсініктері
2 тәжірибелік жұмыс.

Жұмыстың мақсаты: mpC-де қарапайым білімдер қорын құру, оларды өңдеу.

Материалдар және жабдықтар: ДК, mpC программалау ортасы





Достарыңызбен бөлісу:
1   ...   23   24   25   26   27   28   29   30   ...   45




©emirsaba.org 2024
әкімшілігінің қараңыз

    Басты бет