paper3—Algorithm2-Engine-Trigger-on-SMD—temp
来源:互联网 发布:修改gps定位软件 编辑:程序博客网 时间:2024/05/22 04:29
//source code: /run/media/root/E6B2798BB279614B/.../PAPER/paper-3/twin-engine-trigger-code/server-client-pthread-c
----------------------------------------------------------------------------------
Description: guest access FCD by using SMD, there are two parts: browser on SMD and daemon written in c language
//browser on SMD:
guest access server on FCD by using browser on SMD;
socket(); //use WebSocket
connect(); //connect to daemon on SMD
send username to daemon WAIT on the same SMD;
executing tasks in brower; // take some time
if finish tasks then
send finish=1 to daemon WAIT on the same SMD;
end if
//---------------------------------------------------------
//daemon WAIT on SMD that waiting data sent by brower
PROCEDURE: WAIT
socket();
bind();
recvfrom();
if receive username from browser then
write username to pipe;
end if
if receive finish=1 from browser then
write finish=1 to pipe; // send to daemon MAIN
end if
END PROCEDURE
//daemon MAIN on SMD
PROCEDURE: MAIN
socket();
connect(); //connect to TCP Socket on FCD;
//fcdtime: time of sending heartbeat to FCD last;
fcdtime = currenttime;
pthread_create(WAIT); //daemon WAIT on SMD
while true do
read from pipe; //receive from daemon WAIT
if read username from pipe then
send heartbeat to FCD;
send username, processid to FCD;
if receive heartbeat from FCD then
SMD receive current process information from FCD;
update correlative tables in database;
end if
period = currenttime - fcdtime;
if period < 5 then //connectiong to FCD is normal
fcdtime = currenttime;
else if period > 30 then //server shutdown or connectiong to FCD is abnormal
trigger SMD;
redirect to localhost and invoke task in SMD
while true do
send heartbeat to FCD; //probe whether FCD is active
if receive heartbeat from FCD then
read from pipe; //receive from daemon WAIT
if finish=1 then
send finish to FCD;
send information for current process to FCD;
exit;
else
stop accessing MPE;
send information for current process to FCD;
sleep 3s; //waiting for FCD to update it's database
trigger FCD;
redirect to FCD and invoke task in FCD;
end if
end if
sleep 60s;
done //end while
end if
else if read finish=1 from pipe
send finish to FCD;
send information for current process to FCD;
exit;
end if
sleep 5s; //send heartbeat request every 5s to FPE
done
END PROCEDURE
----------------------------------------------------------------------------------
Description: guest access FCD by using SMD, there are two parts: browser on SMD and daemon written in c language
//browser on SMD:
guest access server on FCD by using browser on SMD;
socket(); //use WebSocket
connect(); //connect to daemon on SMD
send username to daemon WAIT on the same SMD;
executing tasks in brower; // take some time
if finish tasks then
send finish=1 to daemon WAIT on the same SMD;
end if
//---------------------------------------------------------
//daemon WAIT on SMD that waiting data sent by brower
PROCEDURE: WAIT
socket();
bind();
recvfrom();
if receive username from browser then
write username to pipe;
end if
if receive finish=1 from browser then
write finish=1 to pipe; // send to daemon MAIN
end if
END PROCEDURE
//daemon MAIN on SMD
PROCEDURE: MAIN
socket();
connect(); //connect to TCP Socket on FCD;
//fcdtime: time of sending heartbeat to FCD last;
fcdtime = currenttime;
pthread_create(WAIT); //daemon WAIT on SMD
while true do
read from pipe; //receive from daemon WAIT
if read username from pipe then
send heartbeat to FCD;
send username, processid to FCD;
if receive heartbeat from FCD then
SMD receive current process information from FCD;
update correlative tables in database;
end if
period = currenttime - fcdtime;
if period < 5 then //connectiong to FCD is normal
fcdtime = currenttime;
else if period > 30 then //server shutdown or connectiong to FCD is abnormal
trigger SMD;
redirect to localhost and invoke task in SMD
while true do
send heartbeat to FCD; //probe whether FCD is active
if receive heartbeat from FCD then
read from pipe; //receive from daemon WAIT
if finish=1 then
send finish to FCD;
send information for current process to FCD;
exit;
else
stop accessing MPE;
send information for current process to FCD;
sleep 3s; //waiting for FCD to update it's database
trigger FCD;
redirect to FCD and invoke task in FCD;
end if
end if
sleep 60s;
done //end while
end if
else if read finish=1 from pipe
send finish to FCD;
send information for current process to FCD;
exit;
end if
sleep 5s; //send heartbeat request every 5s to FPE
done
END PROCEDURE
0 0
- paper3—Algorithm2-Engine-Trigger-on-SMD—temp
- paper3—Algorithm2-Engine-Trigger-on-SMD—temp
- paper3—Algorithm1-Engine-Trigger-on-FCD—temp
- paper3—Algorithm1-Engine-Trigger-on-FCD—temp
- Algorithm2——斐波那契数列
- SMD
- ORACLE TRIGGER ON DDL
- jquery off on trigger
- Oracle —— before row trigger OR after row trigger
- paper4—Multi-MPE_Trigger_Algorithm—temp
- DML statment cannot operate on trigger.new or trigger.old
- Using WITH Clause to mimic App Engine Temp Tables
- I/O上的等待事件 —— direct path read temp、direct path write temp
- BRCM-smd
- jquery——trigger的联动
- jquery——trigger change的联动
- oracle trigger for table on commit
- oracle trigger for table on commit
- C++基础实例-类(6)
- InnoDB删除数据后磁盘空间如何释放
- Android 触摸事件机制(二) Activity中触摸事件详解
- android实现cordova 配置安装及项目创建导入eclipse添加对话框插件
- CentOS 7下Adobe Flash Player的安装、更新和卸载
- paper3—Algorithm2-Engine-Trigger-on-SMD—temp
- javascript 闭包
- 元素的水平居中总结
- adt-bundle安装手顺及错误处理
- redis的简单使用
- Training Region-based Object Detectors with Online Hard Example Mining - cvpr 2016 oral
- SQLite的操作简单介绍
- cocoaPods 使用
- NIO边看边记 之 channel(二)