FuturesUnordered - Reduce number of threads concurrently executing

I am trying to use UnorderedMap to simulate IoT devices on a large scale (>20k).

Unfortunately, UnorderedMap spawns a lot of threads and I am quickly running into OS limitations where the actual work is actually miniscule and could be done by very few threads - if not a single one.

#[macro_use]
extern crate error_chain;

extern crate futures;
extern crate tokio_core;
extern crate tokio_io;
extern crate tokio_periodic;
extern crate tokio_timer;

use futures::stream::Stream;
use tokio_core::reactor::Core;
use tokio_core::net::TcpListener;

use futures::future::{Future, BoxFuture};
use futures::{Async,Poll};

use std::vec::Vec;

mod error {
error_chain! {
    foreign_links {
        Fmt(::std::fmt::Error);
        Io(::std::io::Error) #[cfg(unix)];
        Timer(::tokio_timer::TimerError);
    }

    errors {
        Stuff(t: String) {
            description("invalid stuff")
            display("invalid stuff: '{}'", t)
        }

        Things(v: String) {
            description("unknown thing"), // note the ,
            display("unknown thing: '{}'", v), // trailing comma is allowed
        }
    }
}
}




#[derive(Clone, Debug, Eq, PartialEq)]
enum Action {
    WorkWork,
    DillyDally,
    YodaYada,
}


use std::collections::VecDeque;


struct Squeeze {
    actions : Vec<Action>,
    current : Option<Action>,
}

impl Squeeze {
    pub fn new() -> Self {
        let mut x = Self {
            actions : vec![],
            current : None,
        };
        x.actions.push(Action::WorkWork);
        x.actions.push(Action::DillyDally);
        x.actions.push(Action::YodaYada);
        x
    }

    pub fn next(&mut self) -> Option<Action> {
        self.current = self.actions.pop();
        self.current.clone()
    }
}

impl Stream for Squeeze {
    type Item = Action;
    type Error = error::Error;

    fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
        // lazy_static!{
        //     let TIMER = Timer::default();
        // }
        if let Some(action) = self.next() {
            println!("Action {:?}", &action);
            Ok(Async::Ready(Some(action)))
        } else {
            println!("No Actions left");
            //Ok(Async::NotReady) // still some actions to run
            Ok(Async::Ready(None))
        }
    }
}


type MyFut = BoxFuture<(), error::Error>;

fn main() {
    let mut core = tokio_core::reactor::Core::new().unwrap();
    let handle = core.handle();

    let mut fmap = futures::stream::FuturesUnordered::new();

    for i in 0..4000 { // this can't go much higher without fiddling with OS limits, though not actually necessary
        let work_stream = Squeeze::new();
        let work_fut = work_stream.for_each(|action| {
            println!("Action by Future {:?}", action);
            let timer = tokio_timer::Timer::default();
            let sleep = timer.sleep(std::time::Duration::from_millis(500)).map_err(|e| error::ErrorKind::Stuff("Happy".into()).into());
            sleep
            //futures::future::result::<(),error::Error>(Ok(()))
        } );
        fmap.push(Box::new(work_fut));
    }
    let _ = core.run(fmap.into_future());//.unwrap();

    println!("All work is done!");

}
1 Like

You’re running on a single Core which is a single thread internally. Where are you seeing many threads starting?

            // let timer = tokio_timer::Timer::default();
            // let sleep = timer.sleep(std::time::Duration::from_millis(500)).map_err(|e| error::ErrorKind::Stuff("Happy".into()).into());
            // sleep

            // futures::future::result::<(),error::Error>(Ok(()))


            use tokio_core::reactor::{Handle, Timeout};
            let timeout = Timeout::new(
                                    std::time::Duration::from_secs(3),
                                    &handle,
                                ).unwrap();
            timeout.map(|_| {()} ).map_err(|_| { error::ErrorKind::Things("Test".into()).into()})

Using the Timeout from tokio_core seems to work way better, ps -eLF then only shows one process and at least up to 100_000 it works just fine.

ps -eLF just because the tokio core runs on a single core does not imply anything for the other crates/tokio extensions.

Output procuded utilizing tokio_timer

...
bernhard 27698 27692 30352  0 2987 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30353  0 2987 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30354  0 2987 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30355  0 2987 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30356  0 2987 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30357  0 2987 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30358  0 2987 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30359  0 2987 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30360  0 2987 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30361  0 2987 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30362  0 2987 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30363  0 2987 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30364  0 2988 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30365  0 2988 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30366  0 2988 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30367  0 2988 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30368  0 2988 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30369  0 2988 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30370  0 2988 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30371  0 2988 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30372  0 2988 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30373  0 2988 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30374  0 2988 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30375  0 2988 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30376  0 2988 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30377  0 2988 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30378  0 2988 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30379  0 2988 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30380  0 2988 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30381  0 2988 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30382  0 2988 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30383  0 2988 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30384  0 2989 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30385  0 2989 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30386  0 2989 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30387  0 2989 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30388  0 2989 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30389  0 2989 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30390  0 2989 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30391  0 2989 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30392  0 2989 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30393  0 2989 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30394  0 2989 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30395  0 2989 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30396  0 2989 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30397  0 2989 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30398  0 2989 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30399  0 2989 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30400  0 2989 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30401  0 2989 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30402  0 2989 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30403  0 2989 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30404  0 2990 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30405  0 2990 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30406  0 2990 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30407  0 2990 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30408  0 2990 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30409  0 2990 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30410  0 2990 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30412  0 2990 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30413  0 2990 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30414  0 2990 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30415  0 2990 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30416  0 2990 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30417  0 2990 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30418  0 2990 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30419  0 2990 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30420  0 2990 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30421  0 2990 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30422  0 2990 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30423  0 2990 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30424  0 2990 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30425  0 2990 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30426  0 2991 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30427  0 2991 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30428  0 2991 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30429  0 2991 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30430  0 2991 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30431  0 2991 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30432  0 2991 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30433  0 2991 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30434  0 2991 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30435  0 2991 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30436  0 2991 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30437  0 2991 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30438  0 2991 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30439  0 2991 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30440  0 2992 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30441  0 2992 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30442  0 2992 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30443  0 2992 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30444  0 2992 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30445  0 2992 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30446  0 2992 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30447  0 2992 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30448  0 2992 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30449  0 2992 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30450  0 2992 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30451  0 2992 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30452  0 2992 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30453  0 2992 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30454  0 2992 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30455  0 2993 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30456  0 2993 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30457  0 2993 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30458  0 2993 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30459  0 2993 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30460  0 2993 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30461  0 2993 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30462  0 2993 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30463  0 2993 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30464  0 2993 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30465  0 2993 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30466  0 2993 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30467  0 2993 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30468  0 2993 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30469  0 2994 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30470  0 2994 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30471  0 2994 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30472  0 2994 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30473  0 2994 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30474  0 2994 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30475  0 2994 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30476  0 2994 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30477  0 2994 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30478  0 2994 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30479  0 2994 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30480  0 2994 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30481  0 2994 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30482  0 2994 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30483  0 2994 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30484  0 2995 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30485  0 2995 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30486  0 2995 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30487  0 2995 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30488  0 2995 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30489  0 2995 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30490  0 2995 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30491  0 2995 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30492  0 2995 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30493  0 2995 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30494  0 2995 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30495  0 2995 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30496  0 2995 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30497  0 2995 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30498  0 2995 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30499  0 2995 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30500  0 2995 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30501  0 2995 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30502  0 2995 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30503  0 2996 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30504  0 2996 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30505  0 2996 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30506  0 2996 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30507  0 2996 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30508  0 2996 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30509  0 2996 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30510  0 2996 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30511  0 2996 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30512  0 2996 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30513  0 2996 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30514  0 2996 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30515  0 2996 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30516  0 2996 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30517  0 2996 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30518  0 2996 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30519  0 2996 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30520  0 2997 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30521  0 2997 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30522  0 2997 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30523  0 2997 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30524  0 2997 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30525  0 2997 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30526  0 2997 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30527  0 2997 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30528  0 2997 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30529  0 2997 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30530  0 2997 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30531  0 2997 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30532  0 2997 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30533  0 2997 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30534  0 2997 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30535  0 2998 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30536  0 2998 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30537  0 2998 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30538  0 2998 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30539  0 2998 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30540  0 2998 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30541  0 2998 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30542  0 2998 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30543  0 2998 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30544  0 2998 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30545  0 2998 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30546  0 2998 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30547  0 2998 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30548  0 2998 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30549  0 2998 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30550  0 2998 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30551  0 2998 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30552  0 2998 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30553  0 2998 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30554  0 2998 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30555  0 2998 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30556  0 2999 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30557  0 2999 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30558  0 2999 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30559  0 2999 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30560  0 2999 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30561  0 2999 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30562  0 2999 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30563  0 2999 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30564  0 2999 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30565  0 2999 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30566  0 2999 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30567  0 2999 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30568  0 3000 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30569  0 3000 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30570  0 3000 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30571  0 3000 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30572  0 3000 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30573  0 3000 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30574  0 3000 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30575  0 3000 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30576  0 3000 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30577  0 3000 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30578  0 3000 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30579  0 3000 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30580  0 3000 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30581  0 3000 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30582  0 3000 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30583  0 3000 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30584  0 3000 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30585  0 3001 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30586  0 3001 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30587  0 3001 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30588  0 3001 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30589  0 3001 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30590  0 3001 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30591  0 3001 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30592  0 3001 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30593  0 3001 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30594  0 3001 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30595  0 3001 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30596  0 3001 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30597  0 3001 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30598  0 3001 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30599  0 3001 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30600  0 3002 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30601  0 3002 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30602  0 3002 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30603  0 3002 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30604  0 3002 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30605  0 3002 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30606  0 3002 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30607  0 3002 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30608  0 3002 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30609  0 3002 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30610  0 3002 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30611  0 3002 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30612  0 3002 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30613  0 3002 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30614  0 3002 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30615  0 3003 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30616  0 3003 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30617  0 3003 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30618  0 3003 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30619  0 3003 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30620  0 3003 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30621  0 3003 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30622  0 3003 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30623  0 3003 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30624  0 3003 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30625  0 3003 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30626  0 3003 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30627  0 3003 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30628  0 3003 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30629  0 3003 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30630  0 3004 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30631  0 3004 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30632  0 3004 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30633  0 3004 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30634  0 3004 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30635  0 3004 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30636  0 3004 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30637  0 3004 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30638  0 3004 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30639  0 3004 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30640  0 3004 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30641  0 3004 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30642  0 3004 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30643  0 3004 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30644  0 3004 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30645  0 3005 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30646  0 3005 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30647  0 3005 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30648  0 3005 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30649  0 3005 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30650  0 3005 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30651  0 3005 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30652  0 3005 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30653  0 3005 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30654  0 3005 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30655  0 3005 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30656  0 3005 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30657  0 3005 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30658  0 3005 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30659  0 3005 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30660  0 3006 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30661  0 3006 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30662  0 3006 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30663  0 3006 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30664  0 3006 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30665  0 3006 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30666  0 3006 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30667  0 3006 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30668  0 3006 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30669  0 3006 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30670  0 3006 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30671  0 3006 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30672  0 3006 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30673  0 3006 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30674  0 3006 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30675  0 3007 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30676  0 3007 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30677  0 3007 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30678  0 3007 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30679  0 3007 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30680  0 3007 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30681  0 3007 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30682  0 3007 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30683  0 3007 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30684  0 3007 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30685  0 3007 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30686  0 3007 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30687  0 3007 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30688  0 3007 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30689  0 3007 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30690  0 3008 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30691  0 3008 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30692  0 3008 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30693  0 3008 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30694  0 3008 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30695  0 3008 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30696  0 3009 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30697  0 3009 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30698  0 3009 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30699  0 3009 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30700  0 3009 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30701  0 3009 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30702  0 3009 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30703  0 3009 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30704  0 3009 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30705  0 3009 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30706  0 3009 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30707  0 3009 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30708  0 3009 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30709  0 3009 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30710  0 3009 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30711  0 3010 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30712  0 3010 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30713  0 3010 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30714  0 3010 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30715  0 3010 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30716  0 3010 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30717  0 3010 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30718  0 3010 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30719  0 3010 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30720  0 3010 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30721  0 3010 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30722  0 3010 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30723  0 3010 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30724  0 3010 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30725  0 3010 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30726  0 3010 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30727  0 3010 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30728  0 3011 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30729  0 3011 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30730  0 3011 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30731  0 3011 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30732  0 3011 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30733  0 3011 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30734  0 3011 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30735  0 3011 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30736  0 3011 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30737  0 3011 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30738  0 3011 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30739  0 3011 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30740  0 3011 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30741  0 3011 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30742  0 3011 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30743  0 3011 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30744  0 3011 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30745  0 3012 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30746  0 3012 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30747  0 3012 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30748  0 3012 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30749  0 3012 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30750  0 3012 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30751  0 3012 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30752  0 3012 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30753  0 3012 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30754  0 3012 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30755  0 3012 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30756  0 3012 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30757  0 3012 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30758  0 3012 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30759  0 3012 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30760  0 3012 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30761  0 3012 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30762  0 3012 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30763  0 3012 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30764  0 3013 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30765  0 3013 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30766  0 3013 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30767  0 3013 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30768  0 3013 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30769  0 3013 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30770  0 3013 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30771  0 3013 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30772  0 3013 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30773  0 3013 12:56 pts/4    00:00:00 target/debug/x
bernhard 27698 27692 30774  0 3013 12:56 pts/4    00:00:00 target/debug/x
...

Just an excerpt from what it actually shows, ran via cargo r.

Yeah, I missed that you were using tokio_timer::Timer - that spawns a thread for each instance (and that's mentioned in its documentation). If you're working with Core and using components that don't take a Handle in their setup, you can be pretty certain they're not using the Core to drive themselves :slight_smile:.

1 Like

I must have missed that part of the documentation, I actually double checked but I guess I did not put enough attention to it.

For anyone reading this later, it's in the first sentence of this section (granted, this probably should be further up in the docs): tokio_timer - Rust