Loading

İletişim

muhammedozturk@sakarya.edu.tr

+90 (264) 295 69 09

Duyurular

Deadlock

public class TestThread { public static Object Lock1 = new Object(); public static Object Lock2 = new Object(); public static void main(String args[]) { ThreadDemo1 T1 = new ThreadDemo1(); ThreadDemo2 T2 = new ThreadDemo2(); T1.start(); T2.start(); } private static class ThreadDemo1 extends Thread { public void run() { synchronized (Lock1) { System.out.println("Thread 1: Holding lock 1..."); try { Thread.sleep(10); } catch (InterruptedException e) {} System.out.println("Thread 1: …

Genel - 8 Aralık 2016

Semaphore

import java.util.concurrent.Semaphore ; public class Example extends Thread{             int id;             static Semaphore semaphore = new Semaphore (1);             public Example(int id){                         thi…

Genel - 8 Aralık 2016

8. hafta işletim

package deneme; import java.util.Map; import java.lang.*;   public class TestThread {                public final static int NUMTHREADS   = 3;                public static int sharedData  = 0;                public static int sharedData2 = 0;        …

Genel - 24 Kasım 2016

7. hafta

package ureticiTuketici;   public class ureticiTuketici {       public static void main(String[] args) {         kubDelik c = new kubDelik();         uretici p1 = new uretici(c, 1);         tuketici c1 = new tuketici(c, 1);           p1.start();         c1.start();     } } ======…

Genel - 22 Kasım 2016

6.hafta ve odevKOd

1.örnek: package deneme; import java.util.Map; import java.lang.*; public class TestThread {                 /**Main method*/               public static void main(String[] args) throws InterruptedException               {               &nb…

Genel - 4 Kasım 2016

5. hafta

public class ThreadA { public static void main(String[] args) { ThreadB b = new ThreadB(); b.start(); System.out.println("Total is: " + b.total); } } class ThreadB extends Thread { int total; @Override public void run() { for (int i = 0; i < 100; i++) { total += i; } } } ====================== public class ThreadA { public static void main(String[] args){ ThreadB b = new ThreadB(); b.start(); synchronized(b){ try{ System.out.println("Waiting for b to complete..."); b.wait(…

Genel - 2 Kasım 2016