Multithreading example

Source text Webserver
client1:Actor
client2:Actor
webServer:Server[a]
/t1:Thread[a]
/t2:Thread[a]
localDisk:HDD
client1:webServer.GET /
webServer[,0]:>t1.new
t1[,1]:page=localDisk.read("/var/www/index.html")
client2:webServer.GET /doc/menu.html
webServer[,2]:>t2.new
t2[,3]:page=localDisk.read("/var/www/doc/menu.html")
t2:client2.send(page)
t1[,1]:client1.send(page)
t1:stop
t2[,3]:stop
Back to top of page