Is multithreading possible in c on linux platform

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gnanapoongothai
    New Member
    • Jun 2007
    • 62

    Is multithreading possible in c on linux platform

    HI,
    i am assigned a project of grid computing. so i must know where multithreading is possible on linux. ANd by how u can do that. I know in windows MPC is available. What about linux?
  • gpraghuram
    Recognized Expert Top Contributor
    • Mar 2007
    • 1275

    #2
    HI,
    You can posix multithreading in C in Linux.
    Try to do a search with "Posix multithreading" and u will get the info u need.

    Thanks
    Raghuram

    Comment

    • gnanapoongothai
      New Member
      • Jun 2007
      • 62

      #3
      Hi,
      Thanks for ur advice. Is that both MPc and posixs are compatable.Mean s i want to develope an application which distribute threads to the other pcs .and it has to send the result. THe same applicaton is it possible in linux and windows.

      Comment

      • svlsr2000
        Recognized Expert New Member
        • Feb 2007
        • 181

        #4
        Can you be more clear in ur requirement, what exactly you want to do??

        Comment

        • JosAH
          Recognized Expert MVP
          • Mar 2007
          • 11453

          #5
          Originally posted by gnanapoongothai
          Hi,
          Thanks for ur advice. Is that both MPc and posixs are compatable.Mean s i want to develope an application which distribute threads to the other pcs .and it has to send the result. THe same applicaton is it possible in linux and windows.
          Google for 'MPI' (Message Passing Interface); it does exactly what you want.

          kind regards,

          Jos

          Comment

          • weaknessforcats
            Recognized Expert Expert
            • Mar 2007
            • 9214

            #6
            Originally posted by gnanapoongothai
            Thanks for ur advice. Is that both MPc and posixs are compatable.Mean s i want to develope an application which distribute threads to the other pcs .and it has to send the result. THe same applicaton is it possible in linux and windows.
            You cannot have the same threads run on both Linus and Windows. Threads on Linux must have the form:

            [code=c]
            void* MyThread(void*) ;
            [/code]

            On Windows the threads must have this form:
            [code=c]
            DWORD WINAPI MyThread(LPVOID );
            [/code]

            You will need Linus code and Windows code and then you must compile separately for each OS.

            Comment

            • JosAH
              Recognized Expert MVP
              • Mar 2007
              • 11453

              #7
              Originally posted by weaknessforcats
              You cannot have the same threads run on both Linus and Windows. Threads on Linux must have the form:

              [code=c]
              void* MyThread(void*) ;
              [/code]

              On Windows the threads must have this form:
              [code=c]
              DWORD WINAPI MyThread(LPVOID );
              [/code]

              You will need Linus code and Windows code and then you must compile separately for each OS.
              Or use the Windows port of MPI; it's a great product; I can recommend it; I've
              used several computer architectures ranging from Windows PCs to 512 node
              IBM PSs and a bunch of Crays, all in one virtual parallel machine cluster. MPIch
              is a free implementation. Google for it; it's easily found; and it's fun to use.

              kind regards,

              Jos

              Comment

              Working...