1 / 16

Networking

Networking. Server Socket waits for client connections and returns a dedicated socket for each new client. welcoming socket. client socket. connection socket. client process. server process. Heap. object of class Bob. Heap. object of class Bob. Heap. object of class Bob. ‘Lock’. Heap.

olwen
Download Presentation

Networking

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Networking • Server Socket waits for client connections and returns a dedicated socket for each new client

  2. welcomingsocket clientsocket connectionsocket clientprocess serverprocess

  3. Heap object of class Bob

  4. Heap object of class Bob

  5. Heap object of class Bob ‘Lock’

  6. Heap object of class Bob ‘Monitor’

  7. Race Condition

  8. Race Condition Concurrency Problem병행성 문제

  9. counter = 1 x = 2 class Bob { int counter = 1; void add_One { int x = counter + 1; .... .... .... .... counter = x; } } T1 counter = 2 T2 counter를 아직update 안 했어요! counter = 2

  10. 없는대.. counter = 1 x = 2 counter = 2 counter = 2 x = 3 OK 잠깐 OK! 잠깐 ‘lock’ 어디 있니? ‘lock’ 어디 있니? class Bob { int counter = 1; synchronized void add_One { int x = counter + 1; .... .... .... .... counter = x; } } T1 T1 I’ll wait T2 T2 counter = 3

  11. class Bob { int counter = 1; synchronized void add_One { int x = counter + 1; .... .... .... .... counter = x; } } T1 T2 T2 counter = 3

  12. Class Locks T1 Bob synchronized void m1() void m2() static synchronized void m3() wait! T2

  13. Class Locks T1 Bob synchronized void m1() void m2() static synchronized void m3() 됩니다! T2

  14. Class Locks T1 Bob synchronized void m1() void m2() static synchronized void m3() 됩니다! T2

  15. Class Locks T1 Bob synchronized void m1() void m2() static synchronized void m3() wait! T2

  16. Finally T1 Bob synchronized void m1() synchronized void m2() wait! T2

More Related