항상 감사하며 마633

고정 헤더 영역

글 제목

메뉴 레이어

항상 감사하며 마633

메뉴 리스트

  • 홈
  • 태그
  • 방명록
  • 분류 전체보기 (93)
    • 개발 (59)
      • 개발환경설정 (6)
      • python-심화(Advanced) (23)
      • python-객체지향프로그래밍(OOP) (21)
      • python-병렬처리 (7)
      • python-속도향상(optimization) (2)
    • Study (16)
      • DeepLearning from scratch (16)
    • paper review (15)
      • NLP (15)
    • Google Machine Learning Boo.. (3)

검색 레이어

항상 감사하며 마633

검색 영역

컨텐츠 검색

개발/python-병렬처리

  • 파이썬 비동기 처리 작업 구현 - asyncio 라이브러리

    2022.05.12 by Matthew0633

  • Futures 라이브러리와 파이썬 병렬성 구현 - GIL, concurrent.futures

    2022.05.12 by Matthew0633

  • 코루틴 (Coroutine) (3) - 개념, 장점, 구현

    2022.05.11 by Matthew0633

  • 코루틴 (Coroutine) (2) - 병행성과 Generator

    2022.05.11 by Matthew0633

  • 코루틴 (Coroutine) (1) - Iterator 와 Generator

    2022.05.11 by Matthew0633

  • 클로저 (Closure) (2) - 클로저 개념 및 구현

    2022.05.09 by Matthew0633

  • 클로저 (Closure) (1) - 일급함수 (First-class function)

    2022.05.06 by Matthew0633

파이썬 비동기 처리 작업 구현 - asyncio 라이브러리

asyncio 라이브러리 ( 공식문서 : https://docs.python.org/3.7/library/asyncio.html ) Queue 기반으로 동작하는 병렬처리를 위한 라이브러리이다 비동기 i/o 코루틴을 통한 동시 작업을 지원한다 async, await 의 keyword 를 사용할 수 있다 pip, conda를 통한 설치 필요 Blocking I/O: 호출된 함수가 자신의 작업이 완료될 때까지 제어권을 가진다. 타 함수는 대기 Non-Blocking I/O : 호출된 함수(서브루틴)이 return 후 (코루틴의 yield) 호출한 함수 (메인루틴) 에 제어권 전달, 또 다른 함수 작업 (서브루틴) 을 진행할 수 있다 asyncio 를 효과적으로 쓰려면? 내가 쓰려는 함수가 Blocking 으로..

개발/python-병렬처리 2022. 5. 12. 19:09

Futures 라이브러리와 파이썬 병렬성 구현 - GIL, concurrent.futures

비동기 방식 (asynchrony) Asynchrony, in computer programming, refers to the occurrence of events independent of the main program flow and ways to deal with such events. These may be "outside" events such as the arrival of signals, or actions instigated by a program that take place concurrently with program execution, without the program blocking to wait for results.[1] Asynchronous input/output is an..

개발/python-병렬처리 2022. 5. 12. 19:08

코루틴 (Coroutine) (3) - 개념, 장점, 구현

코루틴이란? 스레드는 OS에서 관리하는 프로세스 내 작업 단위이다. 일반적으로 멀티스레드를 사용하여, CPU 코어에서 실시간, 시분할 비동기 작업을 수행하며 작업의 효율성을 높인다 그런데 단일(싱글)스레드 환경에서도 비동기 작업을 가능하게 하는 설계패턴이 코루틴이다. 단일 작업 (work1, work2, ...) 수행이 정의된 여러 개의 코루틴 함수를 설계하고 이들을 각각 서브루틴으로서 제어하면서 동시에 싱글스레드가 각 서브루틴을 오가며, 동시 작업이 가능한 형태이다. 코루틴을 제어할 때 서브루틴에서는 yield 키워드를, 메인루틴에서는 send 메소드를 사용한다. yield 키워드는 실행지점의 상태를 저장하기 때문에, 메인루틴과 서브루틴 간 양방향 전송이 가능하게 한다 코루틴을 통한 동시 작업 과정 메..

개발/python-병렬처리 2022. 5. 11. 15:56

코루틴 (Coroutine) (2) - 병행성과 Generator

병행성과 병렬성 병행성(Concurrency) : 한 컴퓨터가 여러 일을 동시에 수행 → 단일 프로그램안에서 여러일을 쉽게 해결 (멀티태스킹) 병렬성(Parallelism) : 여러 컴퓨터가 여러 작업을 동시에 수행 Generator란 Generator 는 yield를 통해 메인루틴에 값을 반환하는 것으로 사용될 수 있기 때문에 병행성을 구현할 때 활용이 될 수 있다. Generator 를 정의할 수 있는 방법은 두가지 방식이 있는데, 하나는 함수와 yield를 사용하는 방법이고, 하나는 소괄호 내에 Comprehension 으로 정의하는 방식이다 (Generator Expression 이라고 불리며, Tuple 타입과는 아무 연관성이 없다) # Generator 정의 방법 1 def generator_..

개발/python-병렬처리 2022. 5. 11. 15:56

코루틴 (Coroutine) (1) - Iterator 와 Generator

Iterable 객체와 Iterator 객체 Iterator를 사용하는 이유는 이전 글에서 언급한적이 있는데, next 메소드 실행 시부터 원소를 하나씩 반환하므로, 미리 모든 원소를 메모리에 올려놓지 않아, 메모리 효율적인 특징이 있기 때문이다. Generator는 이렇게 유용한 Iterator를 생성할 수 있는 함수이다. Iterator 객체는 Iter 함수를 통해 생성될수도 있다는 점에서 Iterable 하기 때문에 (그러나 역은 성립하지 않는 것에 주의한다!) 우리는 for문에서 반복을 통해 Iterator를 사용할 수 있다 그렇다면 for문은 어떻게 동작할까. Iterator와 while 문을 활용하면 간단히 for문의 메커니즘을 구현해볼 수 있다. Iterable한 객체로 Iterator 객체..

개발/python-병렬처리 2022. 5. 11. 15:56

클로저 (Closure) (2) - 클로저 개념 및 구현

클로저 (Closure) (Closure in Wiki) In programming languages, a closure, also lexical closure or function closure, is a technique for implementing lexically scoped name binding in a language with first-class functions. Operationally, a closure is a record storing a function[a] together with an environment.[1] The environment is a mapping associating each free variable of the function (variables that..

개발/python-병렬처리 2022. 5. 9. 23:17

클로저 (Closure) (1) - 일급함수 (First-class function)

일급함수 (First-class function) In computer science, a programming language is said to have first-class functions if it treats functions as first-class citizens. This means the language supports passing functions as arguments to other functions, returning them as the values from other functions, and assigning them to variables or storing them in data structures.[1] Some programming language theorist..

개발/python-병렬처리 2022. 5. 6. 20:32

추가 정보

인기글

최신글

페이징

이전
1
다음
TISTORY
항상 감사하며 마633 © Magazine Lab
페이스북 트위터 인스타그램 유투브 메일

티스토리툴바