From: £ukasz <blurrpp@yahoo.com>
To: linux-assembly@vger.kernel.org
Subject: Appendix: multithreating HOWTO ? :)
Date: Sun, 23 Aug 2009 03:29:15 -0700 (PDT) [thread overview]
Message-ID: <556680.44596.qm@web50309.mail.re2.yahoo.com> (raw)
In-Reply-To: <779223.59642.qm@web50307.mail.re2.yahoo.com>
in appendix i want to just precize problem. Broblem is how to write, create etc, shared memory for parent and child proceses, where they could for example exchange wariables
--- On Sat, 8/22/09, £ukasz <blurrpp@yahoo.com> wrote:
> From: £ukasz <blurrpp@yahoo.com>
> Subject: multithreating HOWTO ? :)
> To: linux-assembly@vger.kernel.org
> Date: Saturday, August 22, 2009, 6:48 PM
> Hi All.
> I'm trying to start writing multithread programs with
> assembler (no pthreads), i want to just ask what is wrong in
> folowing simple code:
>
>
> .section .data
>
> signal1:
> .quad 1
>
> signal2:
> .quad 1
>
> x:
> .quad 0
>
> y:
> .quad 0
>
> .section .text
> .globl _start
> _start:
> nop
> movq $2,%rax
> # sys_fork
> xorq %rbx,%rbx
> int
> $0x80
>
> cmpq $0,%rax
> jl end
>
> cmpq $0,%rax
> jg
> parent # jump if
> parent
>
>
> child:
> movq $100,x
> movq $0,signal1
>
> 1:
> cmpq $0,signal2
> jnz 1b
> jmp end
>
>
> parent:
> movq $100,y
> movq $0,signal2
>
> 1:
> cmpq $0,signal1
> jnz
> 1b # INF. LOOP ?
>
> end:
> movq x,%rbx
> addq y,%rby
> movq $1,%rax
> int
> $0x80
>
> Program stacks at parent part in infinite loop waiting for
> "signal1" change to 0. Anybody knows how to write it
> properly with using two threads? Thanks in advance.
>
> Lukas
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe
> linux-assembly" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2009-08-23 10:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-22 16:48 multithreating HOWTO ? :) £ukasz
2009-08-23 10:29 ` £ukasz [this message]
2009-08-23 13:35 ` Appendix: " Claudio Fontana
2009-08-23 15:04 ` Frank Kotler
2009-08-23 15:23 ` Claudio Fontana
2009-08-23 16:17 ` £ukasz
2009-08-23 19:18 ` Frank Kotler
2009-08-23 21:02 ` linuxasm
2009-08-23 19:13 ` £ukasz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=556680.44596.qm@web50309.mail.re2.yahoo.com \
--to=blurrpp@yahoo.com \
--cc=linux-assembly@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).