create new tag
, view all tags
Multi-threading vs multi-processing:
  • Although the multiprocessing module in Python allows the use of multiple CPU cores if available (by bypassing the GIL Global Interpreter Lock) and therefore makes more efficient use of available resources (that is, better performance and CPU usage), its main disadvantage is that it is incredibly difficult to share variables between all the different processes and to synchronise them. The threading module promotes that capability through the use of thread-safe objects such as queues, locks and events. However the disadvantage is that it is not as efficient as the multiprocessing module concurrent processing under threading is limited by the GIL, which also does not support multiple cores that well. However the decision was made to stay with threading due to the ease of concept and of sharing variables. As stated above, the goal of WiSeNeT is not to be the fastest testbed, but to be robust and easy-to-understand.
Queue.Queue() vs list() vs collections.deque():
  • Queue: allows blocking, easy to set max size, thread-safe, can only pop from either end
  • List: fastest for slicing, slow for popping, easy to use and understand
  • Deque: similar to list, faster for popping but poor performance in slicing, can be tricky to use.
  • Hence, for the purposes of this testbed, only queues and lists were utilised.
Time vs datetime:
  • Both modules have very similar functionality, and can be used almost interchangeably. It was decided to use datetime for all statistical functions (e.g. to obtain start/end times) due to its flexibility in outputting and reading time and date formats, and time will primarily be used for its time.sleep() function.
Shell script vs Python script
  • Both languages are equally as powerful as the other. Testing on WiSeNeT was coded using scripts in both languages. However, it is recommended to use Python over Shell whenever possible because variable manipulation is much simpler in Python, functions are a lot more flexible and intuitive, and as WiSeNeT is already coded in Python, some functions can be reused (e.g. test_radio.py). It is also recommended that aloha.sh be ported from Shell script to Python script.
Topic revision: r1 - 2012-01-22 - XiaohongWu
This site is powered by the TWiki collaboration platformCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback