2016년 1월 30일 토요일

Server Virtualization




  • Middleware
 분산 컴퓨팅 환경에서 서로 다른 기종의 하드웨어나 프로토콜, 통신환경 등을 연결하여, 응용프로그램과 그 프로그램이 운영되는 환경 간에 원만한 통신이 이루어질 수 있게 하는 소프트웨어

  • Hypervisor
 호스트 컴퓨터(Host Computers) 1대에서 다수의 운영체제(Operating System)를 동시에 실행하기 위한 논리적 플랫폼(Platform)


  • Server Virtualization
 서버 가상화는 하드웨어에 탑재되어 있는 프로세서나 메모리의 사용 시간, 스토리지의 용량을 작게 분할하여 여러 사용자에게 할당합니다. 사용자는 할당된 시스템 자원을 각각 점유하여 사용할 수 있습니다. 이러한 장치에 의해 물리적으로는 하드웨어가 한 대 뿐이지만 개인 전용의 개별 서버를 각 사용자에게 제공하고 있는 것처럼 보이게 할 수 있습니다. 외관상 하나하나로 보이는 서버를 '가상 서버' 또는 '가상 머신'이라고 하며 이를 실현하는 소프트웨어를 하이퍼바이저(Hypervisor)라고 합니다.

Example)
 VMware : vSphere
 Microsoft : Hyper-V
 Citrix : Xen Server
 Linux : KVM


references) 
책: 그림 한 장으로 보는 최신 IT 트렌드


3. Multiplay Implementation by UDP


  • Add library of 'ws2_32.lib'
  • Execution Sequence
      1. Server and Client information initialization
      2. Client send first data
      3. Tetris Game progressing
      4. if any one lose the game, first index data among sending array data is setting 'Lose Value'
      5. 'Lose User' send data and it close socket
      6. 'Win User' receive Array Data with 'Lose Value' of Opponent
      7. 'Win User' win with using 'Lose Value' of Opponent
      8. 'Win User' close socket

  • Reason 
      if 2 situation doesn't exist, Client'recv() function is blocking.
      if 4~7 situations don't exist, 'Win User' don't know the situation.

  • Next
      4.1 Speed up according to flowing time.
      4.2 Add score bettle system.
      4.3 Finally, I will upgrade quality and perfomance.

Source Download (Github Repository)

Echo Client & Server based on Multiplexing








  • Server based on MultiProcessing is inefficient because it ganerate process whenever clients request connect.
  • Thus, Server provide Two or more client with service using Multiplexsing.
       Use 'select()' function.
     
       As using Multiplexsing,
       One server can receive messages which Clients sended.
       Also, It is efficient about resource because one process processes clients's connect request.
  • Caution 
       MultiProcessing unconditionally isn't inefficient. It depends on the situation.

OS : Windows

Source Download

◈ references
   picture - http://fingerdev.tistory.com/24

2016년 1월 28일 목요일

LECTURE

Problem :  LECTURE

Time : 5minute / 15minute

========================================================

  • C

========================================================

  • C++

========================================================

2016년 1월 27일 수요일

2016년 1월 26일 화요일

2. Tetris Implementation


  • Basic Tetris Game Implementation
  • Key-Operating Method 
       UP : Changes Block 
       DOWN : Goes down Block 
       LEFT : Move to the left
       RIGHT : Move to the right
       SPACE : Goes instantly down

  • Specialization Function
       Game Speed will increase by getting score.
       Next Block is indicated at small block board


Source Download (Github Repository)


references) 
책: C 프로그래밍 파워 업그레이드

Echo Client & Server based on MultiProcessing






This program operate at Linux Environment


  • Server provide Two or more client with service using Multiprocess.
       Use 'fork()' function.
       As using Multiprocess,
       One server can receive messages which Clients sended.

  • Input/Output Routine Division

       Client previously waits until Data sended or received once Data send or receive.
       As using Multiprocess,
       Client's parent process takes charge of 'Data Receive'.
       Client's child process takes charge of 'Data Send'.

OS : Linux
      => Windows don't have function such as 'fork()'
           Windows provide 'CrateProcess()' function. but It completely isn't same function.

Source Code


◈ references
   picture - http://fingerdev.tistory.com/24

2016년 1월 15일 금요일

Array Access for near 8-way index


배열을 사용할 때, 근접한 8개의 인덱스 값들을 검사하는 방법

for (int y = -1; y <= 1; ++y)
{
for (int x = -1; x <= 1; ++x)
{
if ((x | y) && Addition Condition)
array[targetX + x][targetY + y] = value;
}
}
}

- 빨간색은 사용자가 상황에 따라 정의해줘야 할 값들

XHAENEUNG

Problem :  XHAENEUNG
Address : https://algospot.com/judge/problem/read/XHAENEUNG
Language : C++
Time : 1h

My Solution:

FESTIVAL

Problem :  FESTIVAL
Address : https://algospot.com/judge/problem/read/FESTIVAL
Language : C++
Time : 1.5h

My Solution:

1. Console-based Window API Informations Collection


  • Structure

COORD
 Defines the coordinates of a character cell in a console screen buffer. The origin of the coordinate system (0,0) is at the top, left cell of the buffer.
https://msdn.microsoft.com/ko-kr/library/ms682119(v=VS.85).aspx
header file : windows.h

CONSOLE_CURSOR_INFO 
 Contains information about the console cursor.
https://msdn.microsoft.com/ko-kr/library/windows/desktop/ms682068(v=vs.85).aspx
header file : windows.h

CONSOLE_SCREEN_BUFFER_INFO
 Contains information about a console screen buffer.
http://msdn.microsoft.com/ko-kr/library/ms682093(v=VS.85).aspx
header file : windows.h



  • Function

GetStdHandle 
 Retrieves a handle to the specified standard device (standard input, standard output, or standard error).
https://msdn.microsoft.com/ko-kr/library/ms683231
header file : windows.h

SetConsoleTextAttribue
 Sets the attributes of characters written to the console screen buffer by the WriteFile or WriteConsole function, or echoed by the ReadFile or ReadConsole function. This function affects text written after the function call.
https://msdn.microsoft.com/ko-kr/library/windows/desktop/ms686047(v=vs.85).aspx
header file : windows.h

SetConsoleCursorInfo
 Sets the size and visibility of the cursor for the specified console screen buffer.
https://msdn.microsoft.com/ko-kr/library/ms686019(v=VS.85).aspx
header file : windows.h

GetConsoleCursorInfo
 Retrieves information about the size and visibility of the cursor for the specified console screen buffer.
https://msdn.microsoft.com/ko-kr/library/windows/desktop/ms683163(v=vs.85).aspx
header file : windows.h


SetConsoleCursorPosition
 Sets the cursor position in the specified console screen buffer.
https://msdn.microsoft.com/ko-kr/ms686025
header file : windows.h

GetConsoleScreenBufferInfo
 Retrieves information about the specified console screen buffer.
https://msdn.microsoft.com/ko-kr/library/ms683171(v=VS.85).aspx
header file : windows.h

_kbhit()
 Checks the console for keyboard input.
https://msdn.microsoft.com/ko-kr/library/58w7c94c.aspx
header file : conio.h

_getch()
 Gets a character from the console without echo.
https://msdn.microsoft.com/ko-kr/library/078sfkak.aspx
header file : conio.h









Console-based Multiplayer Tetris Game Specifications

Console-based Multiplayer Tetris Game Specifications

  • IDE

       Visual Studio 2015


  • Language

       C


  • Configuration Management

       Git, SourceTree






  • Protocool
       UDP(User Datagram Protocol)

  • Development Order
       1. Console-based API Informations Collection
       2. Tetris Implementation
       3. Multiplay Implementation by UDP
       4. Quality and Performance Upgrade