lab8

Lab8 코드 분석 보고서 (장수제한없음) 및 FileCopy를 넣고 Lab8_학번_이름.zip 압축한 후 e-learning (http://lms.dankook.ac.kr/index.jsp)으로 제출 (Due by 12/10)
java2-lab8

Lab8_1 TCP Client/Server
Lab8_2 UDP Client/Server
Lab8_3 HTTP (GET vs POST)
Lab8_4 ImageTransfer 1 image Client -> Server (using TCP)
Lab8_4 ImageDownloader 1 image Server -> Client (using TCP)
Lab8_4 ImageDownloaderWithFilename 1 image Server -> Client (using TCP)
Lab8_4 MultipleImageTransfer 20 images Client -> Server (using TCP)
Lab8_4 ThreadedMultipleImageTransfer 20 images Client -> Server (using TCP & # of threads)
Lab8_FileCopy (Thread TCP)

lab7

lab7 due by (11/27 23:59) submitted to e-learning (보고서 포함)
java2-lab7

Lab7_1 Multithread synchronization vs no synchronization

Lab7_2 Mutex vs Semaphore vs Monitor

Lab7_3 Mutex vs Semaphore ticketSeller

Lab7_4 Monitor vs Semaphore Producer-Consumer Problem

Lab7_ThreadedImageGrayscale

Lab7 데이터 WOEIDLIST

Java Thread yield() vs join() vs sleep()

https://stackoverflow.com/questions/9700871/what-is-difference-between-sleep-method-and-yield-method-of-multi-threading

We can prevent a thread from execution by using any of the 3 methods of Thread class:

  • yield()
  • join()
  • sleep()

yield() method pauses the currently executing thread temporarily for giving a chance to the remaining waiting threads of the same priority to execute. If there is no waiting thread or all the waiting threads have a lower priority then the same thread will continue its execution. The yielded thread when it will get the chance for execution is decided by the thread scheduler whose behavior is vendor dependent (i.e., yield() can only make a heuristic attempt to suspend the execution of the current thread with no guarantee of when will it be scheduled back).

join() The current thread can invoke join() on any other thread which makes the current thread wait for the other thread to die before proceeding. If any executing thread t1 calls join() on t2 (i.e, t2.join()) immediately t1 will enter into waiting state until t2 completes its execution.

sleep() method can force the scheduler to suspend the execution of the current thread for a specified period of time as its parameter.

Java Thread Synchronization

Thread Synchronization

https://docs.oracle.com/javase/tutorial/essential/concurrency/sync.html

  • Mutex Semaphore (aka Mutex) controls only one thread at a time executing on the shared resource by lock & unlock.
  • Counting Semaphore (aka Semaphore – Java7) controls the number of threads executing on the shared resource by acquire & release.
  • Monitor controls only one thread at a time, and can execute in the monitor (shared object) by wait & notify/notifyAll.

lab6

lab6 due by (11/13 23:59) submitted to e-learning (보고서 포함)

java2-lab6 (updated)

Lab6_1 클래스 Lab6_1

Lab6_1 데이터 lab6-1-data

class BMICalculator extends Person implements HealthCalculator – Body Mass Index(BMI)

BMICalculator, weight, height, index, BMI

class BMRCalculator extends Person implements HealthCalculator – Basal Metabolic Rate(BMR)

BMRCalculator, age, gender, weight, height, index

class BFPCalculator extends Person implements HealthCalculator – Body Fat Percentage(BFP)

BFPCalculator, gender, height, neck, waist, hip, index

class CICalculator extends Person implements HealthCalculator – Calorie Intake (CI)

CICalculator, age, gender, weight, height, activity, index