Skip to content

lock up if VVP is run concurrently #7

@ink1

Description

@ink1

When two or more VVP processes are run concurrently they may all need to open the same background for memory mapping. For some reason the background is opened for read and write rather than for read only and this locks up the processes so everything just hangs.

I've identified the relevant bits of code here
https://github.com/Yandell-Lab/VVP-pub/blob/master/search_binary_bkgrnd.c#L20
https://github.com/Yandell-Lab/VVP-pub/blob/master/search_binary_bkgrnd.c#L24
and here
https://github.com/Yandell-Lab/VVP-pub/blob/master/search_binary_bkgrnd.c#L61
https://github.com/Yandell-Lab/VVP-pub/blob/master/search_binary_bkgrnd.c#L64

I've made a patch which seems to be working although I must admit I have not looked deep into the code.

20c20
<     int fdSrc = open(bin_file, O_RDONLY, 0);
---
>     int fdSrc = open(bin_file, O_RDWR, 0);
24c24
<     mm_bin = (unsigned char *)mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fdSrc, 0);
---
>     mm_bin = (unsigned char *)mmap(NULL, st.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, fdSrc, 0);
61c61
<     int fdSrc = open(bit_file, O_RDONLY, 0);
---
>     int fdSrc = open(bit_file, O_RDWR, 0);
64c64
<     mm_bits = (unsigned char *)mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fdSrc, 0);
---
>     mm_bits = (unsigned char *)mmap(NULL, st.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, fdSrc, 0);

Is write access really necessary?

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