Python Forensics-다중 처리 지원

법의학 전문가들은 일반적으로 일반적인 범죄에서 디지털 증거를 분석하기 위해 디지털 솔루션을 적용하기가 어렵다는 것을 알게됩니다. 대부분의 디지털 조사 도구는 단일 스레드이며 한 번에 하나의 명령 만 실행할 수 있습니다.

이 장에서는 일반적인 포렌식 문제와 관련 될 수있는 Python의 다중 처리 기능에 초점을 맞출 것입니다.

다중 처리

다중 처리는 둘 이상의 프로세스를 지원하는 컴퓨터 시스템의 기능으로 정의됩니다. 다중 처리를 지원하는 운영 체제를 사용하면 여러 프로그램을 동시에 실행할 수 있습니다.

다음과 같은 다양한 유형의 다중 처리가 있습니다. symmetric 과 asymmetric processing. 다음 다이어그램은 일반적으로 법의학 조사에서 따르는 대칭 다중 처리 시스템을 나타냅니다.

예

다음 코드는 Python 프로그래밍에서 내부적으로 서로 다른 프로세스가 나열되는 방식을 보여줍니다.

import random
import multiprocessing

def list_append(count, id, out_list): 
   #appends the count of number of processes which takes place at a time
   for i in range(count):
      out_list.append(random.random())
         
   if __name__ == "__main__": 
      size = 999  
      procs = 2
      # Create a list of jobs and then iterate through 
      # the number of processes appending each process to 
      # the job list  
      jobs = []
         
   for i in range(0, procs): 
      out_list = list() #list of processes 
      process1 = multiprocessing.Process(
         target = list_append, args = (size, i, out_list))

      # appends the list of processes
      jobs.append(process)

   # Calculate the random number of processes
   for j in jobs:
      j.start()  #initiate the process

   # After the processes have finished execution
   for j in jobs:
      j.join()
      print "List processing complete."

여기에서 기능 list_append() 시스템의 프로세스 집합을 나열하는 데 도움이됩니다.

산출

코드는 다음과 같은 출력을 생성합니다.