Parallel algorithms for solving a knapsack problem of size n on PRAM and distributed memory machines are presented. The algorithms are work-efficient in the sense that they achieve optimal speedup with regard to the best known solution to this problem. Moreover, they match the best current time/memory/processors tradeoffs, while requiring less memory and/or processors. Since the PRAM is considered mainly as a theoretical model, and we want to produce practical algorithms for the knapsack problem, its solution in distributed memory machines is also studied. For the first time in literature, work-efficient parallel algorithms on local memory — message passing architectures — are given. Time bounds for solving the problem on linear arrays, meshes, and hypercubes are proved.