Skip to content

New thread is spawned for every I/O request #731

@yjh0502

Description

@yjh0502

When trying to run a sequential I/O with async-std, it seems that new thread is spawned for every I/O request.
Here's strace log for a test workload, which shows that a thread is spawned for every request.

79669 00:41:46.567723 clone( <unfinished ...>
79669 00:41:46.567776 <... clone resumed> child_stack=0x7f2e6d980b70, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7f2e6d9819d0, tls=0x7f2e6d981700, child_tidptr=0x7f2e6d9819d0) = 79670
79669 00:41:46.567800 read(4,  <unfinished ...>
79670 00:41:46.568086 getrandom("\xa5\x37\x5a\x6e\x17\x92\xc9\xfe\xe4\x95\x04\x86\x48\xf0\xc3\x2a\x76\xaa\x6f\x41\x6d\x78\xbb\x13\x30\xdd\x10\x16\x33\x4f\x48\x2f", 32, GRND_NONBLOCK) = 32
79669 00:41:46.569861 <... read resumed> "AndroidManifest.xml\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4194304) = 4194304
79669 00:41:46.570068 exit(0)           = ?
79670 00:41:46.571880 clone(child_stack=0x7f2e6e382b70, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7f2e6e3839d0, tls=0x7f2e6e383700, child_tidptr=0x7f2e6e3839d0) = 79671
79670 00:41:46.571938 read(4,  <unfinished ...>
79671 00:41:46.572264 getrandom("\xbe\xbb\x85\xd2\x92\x95\xa5\xe0\x5e\x4a\xc4\xf7\xb0\x9a\xb0\x87\xa0\x5b\xfe\x4c\xc9\x47\x94\xb9\x25\xb0\x2c\x48\xc2\x87\x3b\x66", 32, GRND_NONBLOCK) = 32
79670 00:41:46.573016 <... read resumed> "\6\20\0u555'\252\25210\0u---#\242\"U\20\4\204\226\256\r\226(P\0\201"..., 4194304) = 4194304
79670 00:41:46.573279 exit(0)           = ?
79671 00:41:46.574703 clone(child_stack=0x7f2e6d980b70, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7f2e6d9819d0, tls=0x7f2e6d981700, child_tidptr=0x7f2e6d9819d0) = 79672
79671 00:41:46.574773 read(4,  <unfinished ...>
79672 00:41:46.575185 getrandom("\xcf\x3b\x90\x37\x9e\x51\x44\xe8\xa4\x87\xe1\x69\x6f\x21\xb3\xb5\xf9\x13\x2a\xfa\xaa\x9a\xdd\x7c\x3d\x52\x6d\xda\xb7\x35\x21\xff", 32, GRND_NONBLOCK) = 32
79671 00:41:46.575597 <... read resumed> "\213d\272\\\346\272\257\247\346i\241\272\241\314\356J\234O\375\355\316\350<%X\327\316\316\275k77"..., 4194304) = 4194304
79671 00:41:46.575822 exit(0)           = ?
79672 00:41:46.577128 clone(child_stack=0x7f2e6e382b70, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7f2e6e3839d0, tls=0x7f2e6e383700, child_tidptr=0x7f2e6e3839d0) = 79673
79672 00:41:46.577190 read(4,  <unfinished ...>
79673 00:41:46.577577 getrandom("\xf5\x32\xc3\x91\xd2\x5d\x82\xee\xe0\x70\x90\x62\xf7\x55\xdf\x06\x52\x9a\x87\x3b\x84\x92\xeb\x12\xbc\x49\x92\x8c\x8b\xba\x4e\x11", 32, GRND_NONBLOCK) = 32
79672 00:41:46.578301 <... read resumed> "\267\377\7\6\307\34\4\271\2+\233\222\1\0*\226\253\0\10<\4\22\34$S\3#\312\t}\263\4"..., 4194304) = 4194304
79672 00:41:46.578501 exit(0)           = ?
79673 00:41:46.579951 clone(child_stack=0x7f2e6d980b70, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7f2e6d9819d0, tls=0x7f2e6d981700, child_tidptr=0x7f2e6d9819d0) = 79674
79673 00:41:46.580029 read(4,  <unfinished ...>
79674 00:41:46.580354 getrandom("\x26\xda\xb7\xd8\xd6\xa8\x94\x81\x7e\xd5\xf2\xba\xa8\x0c\xfe\x97\xd0\x9b\xec\x99\x82\x28\x49\x69\x98\xd4\x3a\x05\x82\xa4\xaf\x92", 32, GRND_NONBLOCK) = 32
79673 00:41:46.580667 <... read resumed> "&\17(\0\377\311\262\t 6Mcx\214\237\257\276\273\305\30Z\262\270\275\301\315\0\10\365\10\1\23"..., 4194304) = 4194304
79673 00:41:46.580907 exit(0)           = ?
79674 00:41:46.582260 clone(child_stack=0x7f2e6e382b70, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7f2e6e3839d0, tls=0x7f2e6e383700, child_tidptr=0x7f2e6e3839d0) = 79675
79674 00:41:46.582322 read(4,  <unfinished ...>
79675 00:41:46.582647 getrandom("\xf5\x1e\xc5\xca\xab\x11\x8c\x8a\x4a\x90\x3f\x93\x11\xbc\x28\x93\xd0\xbb\x29\xa1\x97\x08\xba\xe6\xa9\x9f\xd3\x4e\x2d\xcb\x00\x6a", 32, GRND_NONBLOCK) = 32
79674 00:41:46.583319 <... read resumed> "_\233\5_\233\25\363b\377\0\0\0\0\0\0\0_\233\5_\233\25\363b\377\0\0\0\0\0\0\0"..., 4194304) = 4194304
79674 00:41:46.583526 exit(0)           = ?
79675 00:41:46.584923 clone(child_stack=0x7f2e6d980b70, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7f2e6d9819d0, tls=0x7f2e6d981700, child_tidptr=0x7f2e6d9819d0) = 79676
79675 00:41:46.584994 read(4,  <unfinished ...>
79676 00:41:46.585351 getrandom("\x07\x26\xde\x5d\x98\xf7\x6d\xec\xa9\xb1\x58\xc9\x9d\xc5\x9a\x05\xc4\xaa\x71\x88\xeb\x8c\xcb\x13\x81\x8d\xf0\xce\x05\x91\x09\xa6", 32, GRND_NONBLOCK) = 32
79675 00:41:46.586010 <... read resumed> "\331\331\241\"\214\316\10\214\340\340\250\2\0\0\0\0\340\340\250\2\0\0\0\0\340\340\250\2\0\0\0\0"..., 4194304) = 4194304
79675 00:41:46.586205 exit(0)           = ?

The workload is recorded with

strace -o strace.log -ftt ./target/release/run

and filtered with

grep -vP '(futex|sched|map|sig|prote|prctl|robust_|madvise|exited)' strace.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions