본문 바로가기

Computer Science117

[UNIX/Linux] ep11-2) 소켓 프로그래밍 함수 https://claremont.tistory.com/entry/%EC%9A%B4%EC%98%81%EC%B2%B4%EC%A0%9C-IPCInter-Process-Communication [운영체제] IPC(Inter-Process Communication)https://claremont.tistory.com/entry/ep2-%ED%94%84%EB%A1%9C%EC%84%B8%EC%8A%A4process [운영체제] ep2) 프로세스(process)ㅁ프로세스(process): 실행 중인 프로그램 (실행/스케줄링의 단위 및 자료구조)보조기억장치에 저장claremont.tistory.comhttps://claremont.tistory.com/entry/UNIXLinux-ep11-1-%EC%86%8C%EC%BC.. 2024. 12. 4.
[UNIX/Linux] ep11-1+) 소켓 프로그래밍 기초 함수 실습 ex1. 잘 알려진 포트 번호를 입력받아 이에 해당하는 서비스 명을 출력하는 프로그램을 작성하라#include #include int main() { struct servent* port; int pt; printf("Input port number: "); scanf("%d", &pt); port = getservbyport(htons(pt), NULL); if (port != NULL) { printf("name=%s, port=%d\n", port->s_name, ntohs(port->s_port)); } else { printf("No service for %d\n", pt); } return 0;}   ex2. /etc/h.. 2024. 12. 3.
[UNIX/Linux] ep11-1) 소켓 프로그래밍 기초 https://claremont.tistory.com/entry/%EC%9A%B4%EC%98%81%EC%B2%B4%EC%A0%9C-IPCInter-Process-Communication [운영체제] IPC(Inter-Process Communication)https://claremont.tistory.com/entry/ep2-%ED%94%84%EB%A1%9C%EC%84%B8%EC%8A%A4process [운영체제] ep2) 프로세스(process)ㅁ프로세스(process): 실행 중인 프로그램 (실행/스케줄링의 단위 및 자료구조)보조기억장치에 저장claremont.tistory.com [ep11-1, ep11-2의 학습목표]1. TCP/IP 프로토콜의 기본 개념을 이해한다2. IP 주소와 포트 번호의 개.. 2024. 11. 26.
[UNIX/Linux] ep10-2) 세마포 https://claremont.tistory.com/entry/%EC%9A%B4%EC%98%81%EC%B2%B4%EC%A0%9C-IPCInter-Process-Communication [운영체제] IPC(Inter-Process Communication)https://claremont.tistory.com/entry/ep2-%ED%94%84%EB%A1%9C%EC%84%B8%EC%8A%A4process [운영체제] ep2) 프로세스(process)ㅁ프로세스(process): 실행 중인 프로그램 (실행/스케줄링의 단위 및 자료구조)보조기억장치에 저장claremont.tistory.comhttps://claremont.tistory.com/entry/UNIXLinux-ep10-1-%EB%A9%94%EC%8B.. 2024. 11. 13.
[UNIX/Linux] ep10-1+) 메시지 큐 함수 실습 hw. 자식이 표준 입력한 내용을 mtype=1로 부모에게 전달한다. 더 이상의 내용이 없을 때 자식은 “bye”와 mtype=2를 전달한다. 부모는 mtype=1이면 받은 내용을 표준 출력하고, mtype=2이면 종료하는 프로그램을 작성하라. (메시지 큐가 가장 적합)#include #include #include #include #include #include #define MSGSIZE 128 // 메시지의 최대 크기 정의// 메시지 버퍼 구조체 정의struct msgbuf { long mtype; // 메시지 유형 char mtext[MSGSIZE]; // 메시지 내용};// 부모 프로세스 함수: 자식 프로세스가 보낸 메시지를 수신void parentProcess.. 2024. 11. 7.
[UNIX/Linux] ep10-1) 메시지 큐, 공유 메모리 https://claremont.tistory.com/entry/%EC%9A%B4%EC%98%81%EC%B2%B4%EC%A0%9C-IPCInter-Process-Communication [운영체제] IPC(Inter-Process Communication)https://claremont.tistory.com/entry/ep2-%ED%94%84%EB%A1%9C%EC%84%B8%EC%8A%A4process [운영체제] ep2) 프로세스(process)ㅁ프로세스(process): 실행 중인 프로그램 (실행/스케줄링의 단위 및 자료구조)보조기억장치에 저장claremont.tistory.com [ep10의 학습목표]1. UNIX 시스템 V에서 제공하는 IPC 기법2. 메시지 큐를 이용한 통신 프로그램 작성3. 공.. 2024. 11. 6.
[운영체제] IPC(Inter-Process Communication) https://claremont.tistory.com/entry/ep2-%ED%94%84%EB%A1%9C%EC%84%B8%EC%8A%A4process [운영체제] ep2) 프로세스(process)ㅁ프로세스(process): 실행 중인 프로그램 (실행/스케줄링의 단위 및 자료구조)보조기억장치에 저장된 프로그램을 메모리에 적재하고 실행하는 순간, 그 프로그램은 프로세스가 된다그리고 이 과claremont.tistory.com ㅁ프로세스 간 통신(IPC, Inter-Process Communication): 두 개 이상의 프로세스가 서로 데이터를 교환할 수 있도록 하는 다양한 메커니즘과 기술각 프로세스는 독립된 메모리 공간을 가지고 있기 때문에, 서로 직접 데이터를 공유하지 못한다. 따라서 IPC는 이러한 .. 2024. 11. 6.
[UNIX/Linux] ep7++) 레코드 락킹(advisory locking) https://claremont.tistory.com/entry/%EC%9A%B4%EC%98%81%EC%B2%B4%EC%A0%9C-ep4-1-Concurrency-Mutual-Exclusion-and-Synchronization [운영체제] ep4-1) Concurrency: Mutual Exclusion and Synchronizationㅁ동시성(Concurrency): 여러 작업이 짧은 시간 간격으로 번갈아 가며 수행됨으로써 동시에 처리되는 것처럼 보이게 만드는 것현대 OS는 멀티 프로그래밍, 멀티 프로세싱 등의 기법으로 동시성을 사claremont.tistory.comhttps://claremont.tistory.com/entry/%EC%9A%B4%EC%98%81%EC%B2%B4%EC%A0%9C-e.. 2024. 11. 6.
[UNIX/Linux] ep9+) 파이프 함수 실습 hw1. pipe() 함수를 사용해 부모 프로세스와 자식 프로세스 간에 대화가 가능한 양방향 통신이 되도록 프로그램을 작성하시오(Example : parent-쓰기부터)char msg[256], inmsg[256]; close(fd1[0]);close(fd2[1]);while (1) {    fgets(msg, sizeof(msg) - 1, stdin);    write(fd1[1], msg, sizeof(msg) + 1);    read(fd2[0], msg, 255);} close (fd1[1]); close (fd2[0]);while (1) {    read(fd1[0], inmsg, 255);    fgets(inmsg, sizeof(inmsg) - 1, stdin);    write(fd2[1].. 2024. 11. 4.