



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




that executes what is in the string argument
that executes what is in the string argument
try { Process child1 = Runtime.getRuntime().exec(ā/bin/lsā); InputStream in = child1.getInputStream(); // echo output of ālsā child1.waitFor(); System.out.println(āChild exited with ā + child1.exitValue()); } catch(IOException e) { System.err.println(e); }
read(), write()
1 Process 1 Thread
1 Process 1 Thread
1 Process Multiple Threads
1 Process Multiple Threads
Multiple Processes Multiple Threads/Process
Multiple Processes Multiple Threads/Process
Multiple Processes 1 Thread/Process
Multiple Processes 1 Thread/Process
extension of some parent execute inside a thread. (e.g. Applet)
extension of some parent execute inside a thread. (e.g. Applet)
public class First { public static void main(String args[] ) { Worker1 runner = new Worker1(); runner.start(); System.out.println(āIām a main threadā); } }
class Worker1 extends Thread { public void run() { System.out.println(āIām a worker threadā); } }
public class Printer extends Thread { private int extra; public Printer (int x) {extra = x;} public void run( ) { int y = extra + 1; System.out.println(āTotal is ā + y); }
public class Test { public static void main () { (new Printer(1)).start(); (new Printer(2)).start(); } }
MOV @x,@extra JMP (exit) LOD r1,@extra INC r1, MOV r1,@y CALL (println) JMP (exit)
Printer1 PCPrinter1 PC Printer1 PCPrinter1 PC
Printer2 PCPrinter2 PC Printer2 PCPrinter2 PC Printer1 PCPrinter1 PC Printer2 PCPrinter2 PC Printer2 PCPrinter2 PC Printer2 PCPrinter2 PC
Printer1 PCPrinter1 PC
Printer2 PCPrinter2 PC
Printer1 PCPrinter1 PC
Printer2 PCPrinter2 PC
Printer1 PCPrinter1 PC Printer1 PCPrinter1 PC