A jointly optimal design of control and scheduling in networked systems under denial-of-service attacks