Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #71371
| Path | csiph.com!usenet.pasdenom.info!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.025 |
| X-Spam-Evidence | '*H*': 0.95; '*S*': 0.00; '(at': 0.04; 'beginner': 0.05; 'suppose': 0.07; 'cc:addr:python-list': 0.11; 'python': 0.11; 'thread': 0.14; 'blocked': 0.16; 'etc...': 0.16; 'fine.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'numpy': 0.16; 'subject:audio': 0.16; 'subject:threads': 0.16; 'threads.': 0.16; 'worst': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'mon,': 0.24; 'cc:2**0': 0.24; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'array': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; '(which': 0.31; 'gives': 0.31; 'handled': 0.32; 'quite': 0.32; 'older': 0.33; 'totally': 0.33; 'case,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'collecting': 0.36; 'subject:?': 0.36; 'should': 0.36; 'two': 0.37; 'audio': 0.38; 'tasks': 0.38; 'pm,': 0.38; 'does': 0.39; '12,': 0.39; 'sure': 0.39; 'enough': 0.39; 'most': 0.60; 'more': 0.64; 'between': 0.67; 'believe': 0.68; 'computers': 0.72; 'miss': 0.74; 'subject:Using': 0.84; 'understand,': 0.84; 'wrong...': 0.84; 'to:none': 0.92; '000': 0.93; 'interrupted': 0.96 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=gAgb7tFGPEQQ1BZDfCf49DSlnh6OO4N66dmfYDUmMH8=; b=p630fbqsDcKD7NxHrSqqxlrj0MbsNUZKUM2eG/DKk3AoW91P1JpvzQG9eYzFqUn07R 8AJmM8BsMd+KjWNhW8/0/Idmz27LoNi1kNp9wUOnAdn0f8E23Q1f3s2ntFYe/v9JyH7W 1SbuKRRHQ2obYbLi96Yus26yDLxELeVqNQ8jLGIJIeaGadkOacqeGeldT7xyVsWrOdci 751+3udbdGfPAyeopEmCbnkPPVK05W2+C/M6fKnZBB6rTWn20X6Ez7hOpjNQibebyRAO OhOOovd54HuSaHACndY0mogI0Kiw4mD89hvknHnlmN/3I7f6EKg1mWdxXPF+tWI9AqlY A4Ow== |
| MIME-Version | 1.0 |
| X-Received | by 10.58.154.10 with SMTP id vk10mr21596993veb.18.1399873277996; Sun, 11 May 2014 22:41:17 -0700 (PDT) |
| In-Reply-To | <53705d34$0$2374$426a74cc@news.free.fr> |
| References | <536f869c$0$2178$426a74cc@news.free.fr> <roy-73C8F2.10404911052014@news.panix.com> <536f99eb$0$2109$426a74cc@news.free.fr> <53705d34$0$2374$426a74cc@news.free.fr> |
| Date | Mon, 12 May 2014 15:41:17 +1000 |
| Subject | Re: Using threads for audio computing? |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.9908.1399873286.18130.python-list@python.org> (permalink) |
| Lines | 24 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1399873286 news.xs4all.nl 2924 [2001:888:2000:d::a6]:51794 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:71371 |
Show key headers only | View raw
On Mon, May 12, 2014 at 3:33 PM, lgabiot <lgabiot@hotmail.com> wrote: > But AFAIK the python GIL (and in smaller or older computers that have only > one core) does not permit true paralell execution of two threads. I believe > it is quite like the way multiple processes are handled by an OS on a single > CPU computer: process A has x CPU cycles, then process B has y CPU cycles, > etc... > So in my case, I must have a way to make sure that: > thread 1 (which gets audio from Pyaudio and put() it in the Queue) is not > interrupted long enough to miss a sample. > If I suppose a worst case scenario for the computer, like a raspberry-pi, > the CPU speed is 700MHz, which gives approx 14 000 CPU cycles between each > audio samples (at 48 kHz FS). I don't know if 14 000 CPU cycle is a lot or > not for the tasks at hands. > > Well, at least, it is what I understand, but since I'm really both a > beginner and an hobbyist, I might be totally wrong... The GIL is almost completely insignificant here. One of your threads will be blocked practically the whole time (waiting for more samples; collecting them into a numpy array doesn't take long), and the other is, if I understand correctly, spending most of its time inside numpy, which releases the GIL. You should be able to thread just fine. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Using threads for audio computing? lgabiot <lgabiot@hotmail.com> - 2014-05-11 16:18 +0200
Re: Using threads for audio computing? Roy Smith <roy@panix.com> - 2014-05-11 10:40 -0400
Re: Using threads for audio computing? lgabiot <lgabiot@hotmail.com> - 2014-05-11 17:40 +0200
Re: Using threads for audio computing? lgabiot <lgabiot@hotmail.com> - 2014-05-12 07:33 +0200
Re: Using threads for audio computing? Chris Angelico <rosuav@gmail.com> - 2014-05-12 15:41 +1000
Re: Using threads for audio computing? lgabiot <lgabiot@hotmail.com> - 2014-05-12 07:54 +0200
Re: Using threads for audio computing? Chris Angelico <rosuav@gmail.com> - 2014-05-12 15:58 +1000
Re: Using threads for audio computing? lgabiot <lgabiot@hotmail.com> - 2014-05-12 08:02 +0200
Re: Using threads for audio computing? Stefan Behnel <stefan_ml@behnel.de> - 2014-05-12 08:13 +0200
Re: Using threads for audio computing? lgabiot <lgabiot@hotmail.com> - 2014-05-12 10:14 +0200
Re: Using threads for audio computing? lgabiot <lgabiot@hotmail.com> - 2014-05-12 11:17 +0200
Re: Using threads for audio computing? Sturla Molden <sturla.molden@gmail.com> - 2014-05-14 16:23 +0200
csiph-web